you form is ok but here are some pointers and problems
1. x and y shouln't be global they should be decleared in the scope needed to use them.
2.if (office[x][y] == string) is impossible use
if(strcmp(office[x],string) == 0)
#inlcude <string.h>
int strcmp( const char *string1, const char *string2 )
is a string comparison function from the C standard library
it returns
< 0 string1 less than string2
0 string1 identical to string2
> 0 string1 greater than string2
and as such the y variable becomes unneccessary for this purpose
and the array parameter in lookfor is never used so it is eliminated from the function...
also a for loop could be better utilized here but i will leave it with the while to prevent more confusion...
heres what lookfor should look like
Code:
int LookFor(char* string)
{
int x = 0;
while (x < 11)
{
if(strcmp(office[x],string) == 0)
{
cout << "Found string: " << string << " in" << " Row: " << x << endl;
return 1;
}
else
{
x++;
}
}
}
hope this is helpful and not confusing...