ok sooooooooo somthing like this
i cant use void no more soooo wat i use and i dont think i need noting to returnCode:****(char pos[2][16], char place[11][11],int point[2])
Printable View
ive been playing around with all sorts of ways but still i get nothing
hello i have the same assigment and have similar coding to you.. but just my displaying of the charts that dont look very nice..
it runs but when i put in a a valid place name it doesnt find itCode: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
}
}
}