TheCobyLot

BANK

Sep 14th, 2015
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.79 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. typedef struct b{
  4.     char streetName[60];
  5.     char city[50];
  6.     int postalC[4];
  7.     char country[50];
  8. }Address;
  9. typedef struct f{
  10.     int money;
  11. }balance;
  12. typedef struct c{
  13.     char month[10];
  14.     int day;
  15.     int year;
  16. }birthDate;
  17. typedef struct e{
  18.     char username[50];
  19.     char pin[5];
  20. }login;
  21. typedef struct a{
  22.     char cusFName[50];
  23.     char cusMI;
  24.     char cusLname[50];
  25.     char contact[20];
  26.     balance cusbal;
  27.     Address cAddress;
  28.     birthDate bday;
  29.     login acc;
  30. }Cinfo;
  31. typedef struct d{
  32. Cinfo information;
  33. }Caccount;
  34. void signIn(Caccount fAccount);
  35. void createAcc(Caccount create);
  36. void withdraw(Caccount balance);
  37. int main(){
  38.      Caccount account;
  39.      int opt;
  40.      char opt2;
  41.      printf("Do you have an Existing account?\n");
  42.      printf("Y - Sign in\n");
  43.      printf("N - Create new account\n");
  44.      printf("Enter Option: ");
  45.      scanf("%c", &opt2);
  46.      if(opt2=='Y'){
  47.      do{
  48.      printf("1.) Sign In\n");
  49.      printf("2.) Exit\n");
  50.      scanf("%d", &opt);
  51.      switch(opt){
  52.                case 1: signIn(account); break;
  53.                //case 2: createAcc(account); break;
  54.                default: printf("Try Again");
  55.                }
  56.                }while(opt!=3);
  57.      
  58.     }else if(opt2=='N'){
  59.         createAcc(account);
  60.     }
  61.    printf("\nWould you like to withdraw?");
  62.    printf("\nWould you like deposit?");
  63.    printf("\nW - Withdraw");
  64.    printf("\nD - Deposit");
  65.    printf("\nC - Check Balance")
  66.     return 0;
  67. }
  68. void signIn(Caccount fAccount){
  69.    
  70.     printf("Enter your username: ");
  71.     scanf("%s", &fAccount.information.acc.username);
  72.     printf("Enter your PIN: ");
  73.     scanf("%s", &fAccount.information.acc.pin);
  74.    
  75.    
  76. }
  77. void withdraw(Caccount balance){
  78.    
  79.     printf("How much money you want to withdraw?: ");
  80.     scanf("%d", &balance.information.cusbal);
  81. }
  82. void createAcc(Caccount create){
  83.    
  84.     printf("Please input the following.\n");
  85.     printf("Enter your First Name: ");
  86.     fflush(stdin);
  87.     gets(create.information.cusFName);
  88.     printf("Enter your Middle Initial: ");
  89.     fflush(stdin);
  90.     scanf("%c", &create.information.cusMI);
  91.     printf("Enter your Last Name: ");
  92.     fflush(stdin);
  93.     gets(create.information.cusLname);
  94.     fflush(stdin);
  95.     printf("---ADDRESS---\n");
  96.     printf("Street Name: ");
  97.     fflush(stdin);
  98.     gets(create.information.cAddress.streetName);
  99.     printf("City: ");
  100.     gets(create.information.cAddress.city);
  101.     fflush(stdin);
  102.     printf("Postal Code: ");
  103.     fflush(stdin);
  104.     scanf("%d", create.information.cAddress.postalC);
  105.     printf("Country: ");
  106.     fflush(stdin);
  107.     gets(create.information.cAddress.country);
  108.     printf("---CONTACT NUMBER---");
  109.     printf("\nContact Number: ");
  110.     fflush(stdin);
  111.     gets(create.information.contact);
  112.     fflush(stdin);
  113.     printf("---Money---");
  114.     printf("\nMoney do you want to put: ");
  115.         fflush(stdin);
  116.     scanf("%d", &create.information.cusbal);
  117.     fflush(stdin);
  118.    
  119. }
Add Comment
Please, Sign In to add comment