Ya I did and it almost works, if I use a -1 right away it runs throough one more time, whwn it should just end it. Here's the changed code:
Code:
#include <stdio.h>
int main()
{
float balance, charges, credit, limit;
int account = 0;
for ( ;; )
while(account != -1){
printf("Enter account number (-1 to end): ");
scanf("%d" , &account);
printf("Enter beginning balance: ");
scanf("%f" , &balance);
printf("Enter total charges: ");
scanf("%f" , &charges);
printf("Enter total credits: ");
scanf("%f", &credit);
printf("Enter credit limit: ");
scanf("%f", &limit);
if ( credit > limit )
printf("Credit Limit Exceeded\n");
if(account == -1)
printf("%d", account);
break;
}
return 0;
}
So I'm still kinda at a loss as to how to end the program if account == -1, thanks for your help.
regards,
Extro