SHARE
TWEET

Untitled

a guest Feb 21st, 2020 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. int menu (void){
  3.    int choice;
  4.    //menu Declarations
  5.    
  6.    int accountNum1;
  7.    int accountNum2;
  8.    float balance1;
  9.    float balance2;
  10.    //newAccounts Declarations
  11.    
  12.    int tmp=0;
  13.    int w;
  14.    //withdraw Declaraions
  15.    while(1==1){
  16.       printf("\n--------------------------------\nMain Menu\n");
  17.       printf("\n1 New Accounts\n2 All Accounts\n3 Withdraw\n4 Deposit\n5 Transfer Fund\n6 Exchange Balance\n7 High Balance");
  18.       printf("\n8 Reset All Balance\n9 Change Account Number\n0 Exit\n");
  19.    //menu format
  20.    
  21.       scanf("%d", &choice);
  22.       switch(choice){
  23.          case 1: new_accounts(&accountNum1, &balance1, &accountNum2, &balance2);
  24.             break;
  25.          case 2: summary(accountNum1, balance1, accountNum2, balance2);
  26.             break;
  27.          case 3:
  28.          
  29.             while((tmp!=accountNum1)&&(tmp!=accountNum2)){
  30.            
  31.                printf("Enter an account to withdraw (%d or %d?): ", accountNum1,accountNum2);
  32.                scanf("%d", &tmp);
  33.            
  34.            
  35.                if((tmp!=accountNum1)&&(tmp!=accountNum2))
  36.                
  37.                   printf("invalid account number.\n");
  38.                  
  39.              
  40.             }
  41.             printf("Enter an amount to withdraw: ");
  42.             scanf("%d", &w);
  43.            
  44.          //input validation
  45.          
  46.             if (tmp== accountNum1){
  47.                withdraw(accountNum1, &balance1, w);
  48.             }
  49.             else{
  50.                withdraw(accountNum2, &balance2, w);
  51.             }
  52.          
  53.             break;
  54.          /*
  55.          case 4:  
  56.             while((tmp!=accountNum1)||(tmp!=accountNum2)){
  57.            
  58.                printf("Enter an account to deposit (%d or %d?): ", accountNum1,accountNum2);
  59.                scanf("%d", &tmp);
  60.            
  61.                printf("Enter an amount to deposit: ");
  62.                scanf("%d", &tmp);
  63.            
  64.                if((tmp!=accountNum1)&&(tmp!=accountNum2))
  65.                   printf("invalid account number.\n");
  66.             }
  67.          //input validation
  68.          
  69.             if (tmp== accountNum1){
  70.                withdraw(accountNum1, &balance1, tmp);
  71.             }
  72.             else{
  73.                withdraw(accountNum2, &balance2, tmp);
  74.             }
  75.          
  76.             break;
  77.          /*
  78.       case 5: transfer();
  79.          break;    
  80.       case 6: exchange();
  81.          break;
  82.       case 7: *high_balance();
  83.          break;
  84.       case 8:  reset();
  85.          break;
  86.       case 9: change();
  87.          break;
  88.          */
  89.          case 0: exit(0);
  90.             printf("Goodbye!");
  91.             break;
  92.          default: printf("invalid input");
  93.             break;
  94.       }
  95.    
  96.    }
  97. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top