Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<windows.h>
- #include<stdio.h>
- #include<dos.h>
- #include<stdlib.h>
- #include<math.h>
- #include<iostream>
- using namespace std;
- int main()
- {
- int choice322,loop=0,loop2,loop3,i,pass,choice=1;
- char first2[50],middle2[50],last2[50],account1[50];
- char first1[50][50],middle1[50][50],last1[50][50],search[50],account[50][50];
- float initial[50],deposit,withdraw,initial2;
- intro:
- system("CLS");
- printf("Bank System\n\n\n");
- printf("1. Add Accounts\n");
- printf("2. View Accounts\n");
- printf("3. Deposit\n");
- printf("4. Withdraw\n");
- printf("5. Exit\n");
- scanf("%d",&choice);
- switch(choice)
- {
- case 1:
- system("CLS");
- for(;loop<50;)
- {
- printf("Account #: ");fflush(stdin);
- gets(account[loop]);
- printf("\nFirst Name: ");fflush(stdin);
- /*scanf("%s", &first1[loop]);*/
- gets(first1[loop]);
- printf("\nMiddle Name: ");
- /*scanf("%s", &middle1[loop]);*/
- gets(middle1[loop]);
- printf("\nLast Name: ");
- gets(last1[loop]);
- printf("\nInitial Deposit: ");
- scanf("%f", &initial[loop]);
- loop++;
- break;
- }
- goto intro;
- case 2:
- system("CLS");
- printf("1. Single Account\n");
- printf("2. All Accounts");
- scanf("%d", &choice322);
- if (choice322 == 1)
- {
- goto Single;
- }
- else if (choice322 == 2)
- {
- goto All;
- }
- break;
- case 3:
- system("CLS");
- printf("Search Account #: ");fflush(stdin);
- gets(search);
- for (loop2=0; loop2<loop; loop2++)
- {
- /*if(account[loop] == search[loop])*/
- if(strcmp(account[loop2],search) == 0)
- {
- printf("Enter amount to deposit: ");
- scanf("%f", &deposit);
- initial[loop2]+=deposit;
- printf("Your current money is %.2f",initial[loop2]);
- getchar();
- /*getch();*/
- system("CLS");
- goto intro;
- }
- /*else if (account[loop] != search[loop])*/
- /* if(strcmp(account[loop2],search) != 0)*/
- }
- printf("\n Account number not found.");
- getchar();
- system("CLS");
- goto intro;
- break;
- case 4:
- system("CLS");
- printf("Search Account #: ");fflush(stdin);
- gets(search);
- for (loop2=0; loop2<loop;loop2++)
- {
- if(strcmp(account[loop2],search) == 0)
- {
- printf("Enter amount to withdraw: ");
- scanf("%f",&withdraw);
- initial[loop2]-=withdraw;
- printf("Your current money is now %.2f",initial[loop2]);
- getchar();
- /*getch();*/
- system("CLS");
- goto intro;
- }
- }
- /* else if(strcmp(account[loop2],search) != 0)*/
- printf("\n Account number not found.");
- getchar();
- system("CLS");
- goto intro;
- break;
- case 5:
- {
- exit(0);
- }
- default:
- {
- goto intro;
- }
- }
- Single:
- system("CLS");
- printf("Search Account #: ");fflush(stdin);
- gets(search);
- //cout<<"loop"<<loop;
- for(loop2=0;loop2<loop;loop2++)
- {
- if(strcmp(search,account[loop2])== 0)
- { printf("\nAccount #: ");fflush(stdin);
- puts(account[loop2]);
- printf("\n\nFirst Name: ");
- puts(first1[loop2]);
- printf("\n\nMiddle Name: ");
- puts(middle1[loop2]);
- printf("\n\nLast Name: ");
- puts(last1[loop2]);
- printf("\n\nInitial Deposit: %.2f", initial[loop2]);fflush(stdin);
- //getch();
- getchar();
- system("CLS");
- goto intro;
- }
- }
- printf("\n Account number not found.");
- getchar();
- system("CLS");
- goto intro;
- All:
- system("CLS");
- for(pass = 0; pass<loop; pass++)
- {
- for(i=pass + 1; i<loop; i++)
- {
- if(strcmp(account[pass],account[i])>0)
- {
- strcpy(account1,account[pass]);
- strcpy(account[pass],account[i]);
- strcpy(account[i],account1);
- strcpy(first2,first1[pass]);
- strcpy(first1[pass],first1[i]);
- strcpy(first1[i],first2);
- strcpy(middle2,middle1[pass]);
- strcpy(middle1[pass],middle1[i]);
- strcpy(middle1[i],middle2);
- strcpy(last2,last1[pass]);
- strcpy(last1[pass],last1[i]);
- strcpy(last1[i],last2);
- initial2 = initial[pass];
- initial[pass]=initial[i];
- initial[i]=initial2;
- }
- }
- }
- for(loop3=0; loop3<loop; loop3++)
- {
- printf("Account #: ");fflush(stdin);
- puts(account[loop3]);
- printf("\n\nFirst Name: ");
- puts(first1[loop3]);
- printf("\n\nMiddle Name: ");
- puts(middle1[loop3]);
- printf("\n\nLast Name: ");
- puts(last1[loop3]);
- printf("\n\nInitial Deposit: %.2f",initial[loop3]);
- printf("\n\n\n\n");
- }
- getchar();
- system("CLS");
- goto intro;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement