i have got that problem again and well i cant spot it maybe someone here can spot it ive been looking for ages;
pos is declared asCode:printf("\n Please Enter the number of stops 0-3: ");
scanf("%5d",&numstops);
if(numstops>0)
{
for(i=0;i<numstops;i++)
{
printf("\n Please enter the name for Stop %-1d: ",i+1);
scanf("%16s",&stopname[i]);
if( strcmp( stopname[i], "London" ) == 0 ){stops[i]=0;}
else if( strcmp( stopname[i], "Bath" ) == 0 ){stops[i]=1;}
else if( strcmp( stopname[i], "Cardiff" ) == 0 ){stops[i]=2;}
else if( strcmp( stopname[i], "Carlisle" ) == 0 ){stops[i]=3;}
else if( strcmp( stopname[i], "Durham" ) == 0 ){stops[i]=4;}
else if( strcmp( stopname[i], "Exeter" ) == 0 ){stops[i]=5;}
else if( strcmp( stopname[i], "Leeds" ) == 0 ){stops[i]=6;}
else if( strcmp( stopname[i], "Norwich" ) == 0 ){stops[i]=7;}
else if( strcmp( stopname[i], "Truno" ) == 0 ){stops[i]=8;}
else if( strcmp( stopname[i], "York" ) == 0 ){stops[i]=9;}
else{printf("\n Invalid place please Re enter: ");i--;}
}
if(numstops==1)
{
printf("\n Starting from %s To %s is %d miles",pos[0],stopname[0],chart[point[0]][stops[0]]);
printf("\n From %s To %s is %d miles",stopname[0],pos[1],chart[point[1]][stops[0]]);
printf("\n Total Distance : %-5d",chart[point[0]][stops[0]]+chart[point[1]][stops[0]]);
}
else if(numstops==2)
{
printf("\n Starting from %s To %s is %d miles",pos[0],stopname[0],chart[point[0]][stops[0]]);
printf("\n From %s To %s is %d miles",stopname[0],stopname[1],chart[stops[0]][stops[1]]);
printf("\n From %s To %s is %d miles",stopname[1],pos[1],chart[point[1]][stops[1]]);
printf("\n Total Distance : %-5d",chart[point[0]][stops[0]]+chart[stops[0]][stops[1]]+chart[point[1]][stops[1]]);
}
else if(numstops==3)
{
printf("\n Starting from %s To %s is %d miles",pos[0],stopname[0],chart[point[0]][stops[0]]);
printf("\n From %s To %s is %d miles",stopname[0],stopname[1],chart[stops[0]][stops[1]]);
printf("\n From %s To %s is %d miles",stopname[1],stopname[2],chart[point[0]][stops[2]]);
printf("\n From %s To %s is %d miles",stopname[2],pos[1],chart[point[1]][stops[2]]);
printf("\n Total Distance : %-5d",chart[point[0]][stops[0]]+chart[point[0]][stops[1]]+chart[point[0]][stops[2]]+chart[point[1]][stops[2]]);
}
}
Code:char pos[1][16];
char stopname[2][16];
its when someone puts in for 3 stops i get this output
i put in london as my starting place but on the output for 3 stops i get a diff place name when i call upon it
http://i57.photobucket.com/albums/g2...k/Untitled.jpg
thankyou

