Hi everybody,
I am back for help and advise, this time I do have problem with my loop.The loop is exited when the user type "0"(zero) or the same batter number(double entry), but didn't work!I have to find way to exit the loop and call the next fuction to generate adn print my table, after the array is fill up. Here is my code:
Code:
struct batters get_entry (struct batters data[])
{
int i;
int id_batter;
do
{
printf("Enter batter number:");
scanf("%i",&data[i].id_batter);
printf("Enter number of hits:");
scanf("%i", &data[i].hits);
printf("Enter number of walks:");
scanf("%i", &data[i].walks);
printf("Enter number of outs:");
scanf("%i", &data[i].outs);
printf("Enter 0 to exit program\n");
++i
}
while (id_batter != 0 || id_batter != id_batter);
return (data[i]);
}
Thanks !