When I enter the -999 to break the loop it does not follow to the next loop but ends the program. Am I missing something here??
Code:#include <stdio.h> struct info { int client_num; char last_name[20]; float balance; }; main() { struct info clients[10]; int x; printf ("Enter account number, last name, and balance.\nEnter -999 to end input.\n\n"); for (x = 0; x < 10; x++) { printf ("?"); scanf ("%i", &clients[x].client_num); if (clients[x].client_num == -999) break; scanf ("%s", clients[x].last_name); scanf ("%f", &clients[x].balance); fflush(stdin); getchar(); } printf ("\n\n"); printf ("ACCOUNT LAST NAME BALANCE\n"); for (x = 0; x < 10; x++) { printf ("%08,i%20s,%.102f\n", clients[x].client_num, clients[x].last_name, clients[x].balance); } getchar(); }



LinkBack URL
About LinkBacks


