Hello
The program asks the question one time then stops and creates a micorsoft error message. Could someone take a look at it and see if I am missing something. It is suppose to allow you to enter up to 10 accouts w/name and amounts and break if -999 is entered.
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);
printf ("\n\n");
}
printf ("ACCOUNT \tLAST NAME \tBALANCE\n");
for (x = 0; x < 10; x++)
{
printf ("%08i%20s%.102f\n", clients[x].client_num, clients[x].last_name, clients[x].balance);
}
getchar();
}