Simple question if I may, in the following code why is this statement not working?:
here' the full code:Code:if(account == -1) break;
What I want is when the user does enter - 1 it ends the program, tried it a few different ways and cant't get it to work, thanks for all the help.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) break; } return 0; }
Regards,
Extro



LinkBack URL
About LinkBacks


