Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- typedef struct b{
- char streetName[60];
- char city[50];
- int postalC[4];
- char country[50];
- }Address;
- typedef struct f{
- int money;
- }balance;
- typedef struct c{
- char month[10];
- int day;
- int year;
- }birthDate;
- typedef struct e{
- char username[50];
- char pin[5];
- }login;
- typedef struct a{
- char cusFName[50];
- char cusMI;
- char cusLname[50];
- char contact[20];
- balance cusbal;
- Address cAddress;
- birthDate bday;
- login acc;
- }Cinfo;
- typedef struct d{
- Cinfo information;
- }Caccount;
- void signIn(Caccount fAccount);
- void createAcc(Caccount create);
- void withdraw(Caccount balance);
- int main(){
- Caccount account;
- int opt;
- char opt2;
- printf("Do you have an Existing account?\n");
- printf("Y - Sign in\n");
- printf("N - Create new account\n");
- printf("Enter Option: ");
- scanf("%c", &opt2);
- if(opt2=='Y'){
- do{
- printf("1.) Sign In\n");
- printf("2.) Exit\n");
- scanf("%d", &opt);
- switch(opt){
- case 1: signIn(account); break;
- //case 2: createAcc(account); break;
- default: printf("Try Again");
- }
- }while(opt!=3);
- }else if(opt2=='N'){
- createAcc(account);
- }
- printf("\nWould you like to withdraw?");
- printf("\nWould you like deposit?");
- printf("\nW - Withdraw");
- printf("\nD - Deposit");
- printf("\nC - Check Balance")
- return 0;
- }
- void signIn(Caccount fAccount){
- printf("Enter your username: ");
- scanf("%s", &fAccount.information.acc.username);
- printf("Enter your PIN: ");
- scanf("%s", &fAccount.information.acc.pin);
- }
- void withdraw(Caccount balance){
- printf("How much money you want to withdraw?: ");
- scanf("%d", &balance.information.cusbal);
- }
- void createAcc(Caccount create){
- printf("Please input the following.\n");
- printf("Enter your First Name: ");
- fflush(stdin);
- gets(create.information.cusFName);
- printf("Enter your Middle Initial: ");
- fflush(stdin);
- scanf("%c", &create.information.cusMI);
- printf("Enter your Last Name: ");
- fflush(stdin);
- gets(create.information.cusLname);
- fflush(stdin);
- printf("---ADDRESS---\n");
- printf("Street Name: ");
- fflush(stdin);
- gets(create.information.cAddress.streetName);
- printf("City: ");
- gets(create.information.cAddress.city);
- fflush(stdin);
- printf("Postal Code: ");
- fflush(stdin);
- scanf("%d", create.information.cAddress.postalC);
- printf("Country: ");
- fflush(stdin);
- gets(create.information.cAddress.country);
- printf("---CONTACT NUMBER---");
- printf("\nContact Number: ");
- fflush(stdin);
- gets(create.information.contact);
- fflush(stdin);
- printf("---Money---");
- printf("\nMoney do you want to put: ");
- fflush(stdin);
- scanf("%d", &create.information.cusbal);
- fflush(stdin);
- }
Add Comment
Please, Sign In to add comment