Originally Posted by
matsp
Post what you have tried, and explain what "nothing" means.
--
Mats
Code:
char 2points( char place[11][11], int point[2], char pos[2][16])
{
int x, wrong, flag
for(i=0;i<2;i++) // loops round twice allowing the input of 2 points
{
if(wrong!=1) // if wrong is 0 it will out put the following
{
if(i==0){printf("\n Please enter your Start point: ");} // input first point
if(i==1){printf("\n Please enter your Finishing point: ");} // input first point
}
wrong=0; // set wrong to 0
scanf("%16s", pos[i]);
flag = 0; // sets flag to 0 so place is invalid until found
for(x = 0; x < sizeof(place); x ++) {
if(strcmp(place[x+1], pos[i])==0) {
// place found
point[i] = x; // point at position i is set to the value of x
flag=1; //sets flag as 1 because its a valid place
}
}
if(flag==0) // place not found
{
printf("\n Invalid place name please re enter: ");
i--; // decrements i by 1 sooo it will loop round again
wrong=1; // sets wrong to 1 so the ask for start or finsh point is not asked for again
}
}
}
it runs but when i put in a a valid place name it doesnt find it