Last active
August 29, 2015 14:06
-
-
Save matutter/800702f1e7864c1c07df to your computer and use it in GitHub Desktop.
current tutoring document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| int good_search( int ary[], int size, int item ); | |
| int main(int argc, char const *argv[]) | |
| { | |
| int some_array[] = {1,3,4,5,123,2,123,0,515,13,41,3,12321}; | |
| cout << good_search( some_array, 13, 5 ) << endl; | |
| return 0; | |
| } | |
| int good_search( int ary[], int size, int item ) | |
| { | |
| for( int i = 0; i < size; i++ ) | |
| { | |
| if (ary[i] == item) | |
| { | |
| return 1; | |
| } | |
| } | |
| return 0; | |
| } | |
| int search(int myArray[], int size, int item) | |
| { | |
| int i = 0 | |
| ,f = 0; | |
| A: | |
| if(myArray[i]==item) goto B; | |
| if(i == size) goto C; | |
| i++; | |
| goto A; | |
| B: | |
| f = 1; | |
| C: | |
| return f; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment