Lost and need help with C Program
Hi
I am newbie to the boards and c programming.
I need assistance in creating arrays. The array has to be able to hold 20 IDs (Numbers 1-20) and associated 20 associated ratings (Scaled 1-100), however my assignment asks i be prompted to enter id/rating and really only requires me to enter in 10. It must also terminate when a 0 is entered.
(That part I have, I think, maybe not properly but it works.)
My issue is then getting them to appear in chart that shows
ID Rating
I can't figure out the for loop.
Nothing shows!
Here is my code:
Code:
int main(void)
{
int id[20], rating[20];
int i;
// Enter ID and Rating, terminated if ID entered is a zero
while (id[i]!=0){
printf("Enter ID:");
scanf("%i", &id[i]);
printf ("Enter rating:");
scanf ("%i",&rating[i]);
}
//Table build to show id and rating
printf("\nID Rating\n");
printf("---------- ---------\n");
for () (((((This is the part I cant do to get the table to build and print)))))
printf("%i %i\n",id[i],rating[i]);
return 0;