/* this is your bank.c file */ /* Modified by Adam Smyth */ #include #include #include #include "bank.h" void main() { FILE *fin; char c, string[MAX_STRING + 1]; A_INFO new_account, accounts[MAX_ACCOUNTS]; int num_accounts=0,i,l; if ((fin = fopen("bank.in","r")) == NULL) { fprintf (stderr, "ERROR : couldn't open file"); exit(1); } while (fgets(string,MAX_STRING,fin)) { rm_newline(string); switch (s_code(string)) { case C_ADD: printf("\n\nNew account:"); new_account = read_new_account(fin); print_a_info(stdout,new_account); add_a_info(accounts,num_accounts,new_account); num_accounts++; break; case C_RBN: printf("\n\nFind account by name:"); get_a_byname(accounts, l,rm_newline(fgets(string,MAX_STRING,fin))); break; case C_RBA: printf("\n\nFind account by account number:"); i=get_a_byan(accounts, num_accounts, rm_newline(fgets(string,80,fin))); if(i!=NOT_FOUND) print_a_info(stdout,accounts[i]); else printf("\nAccount not found!"); break; case C_RAA: printf("\n\nReport all accounts:"); for(i=0;i