Skip to content

Instantly share code, notes, and snippets.

@matutter
Last active August 29, 2015 14:06
Show Gist options
  • Save matutter/800702f1e7864c1c07df to your computer and use it in GitHub Desktop.
Save matutter/800702f1e7864c1c07df to your computer and use it in GitHub Desktop.
current tutoring document
#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