Question: Explain this coding in detail pls..very detail..When we create new account it creates it own account num I didn't understand how it create it..Explain me

Explain this coding in detail pls..very detail..When we create new account it creates it own account num I didn't understand how it create it..Explain me that part and this whole coding in detail..

#include void creation( ) ; void deposit( ) ; void withdraw( ) ; int a = 0 ; struct bank { int no; char name[20] ; char phoneNo[20]; //phone number int identityCardNumber; //identity card number int age; char address[60]; float bal ; float dep ; } s[100];

int main( ) { int ch ; do { printf(" BANKING SYSTEM ") ; printf(" 1. Create New Account ") ; printf(" 2. Cash Deposit ") ; printf(" 3. Cash Withdraw ") ; printf(" 4. Exit ") ; printf(" Enter your choice : ") ; scanf("%d",& ch) ; //extra space was present in scanf switch (ch) { case 1 : creation( ) ; break ; case 2 : deposit( ) ; break ; case 3 : withdraw( ) ; break ; case 4 : ; break ; defalut : printf(" Choice a Valid option !! ") ; break ; getch( ) ; }} while( ch != 4 ) ; }

void creation( ) { printf(" NEW ACCOUNT CREATION ") ; printf(" Your Account Number is :%d ") ; printf(" Enter your Name : ") ; scanf("%s",s[a].name) ; //space was present in the scanf and & is not required in char array input //input for phone number, id card and address printf("Enter phone no: "); scanf("%s",s[a].phoneNo); printf("Identity card no: "); scanf("%d",&s[a].identityCardNumber); //take sample input to ignore newline from previous input char c; scanf("%c",&c); printf("Enter address: "); scanf("%[^ ]",s[a].address); //to get space seperated input use %[^ ] printf("Your Deposit is Minimum RM.20") ;

s[a].dep=20 ;a++ ; getch() ; } void deposit( ) { int no, b = 0, m = 0 ; float aa ; //data type of aa should be float printf(" CASH DEPOSIT ") ; printf(" Enter your Account Number : ") ; scanf("%d") ; { printf(" Account Number : %d ",s[m].no) ; printf(" Name : %s ",s[m].name) ; printf(" Deposit : %f ",s[m].dep) ; printf(" Deposited Amount : ") ; scanf("%f",&aa) ; s[m].dep+=aa ; printf(" The Balance in Account is : %f ",s[m].dep) ; getch() ; }

{ printf(" ACCOUNT NUMBER IS INVALID ") ; getch( ) ; } } void withdraw( ) { int no, b = 0, m = 0 ; float aa ; //data type of aa should be float printf(" CASH WITHDRAW ") ;; printf(" Enter your Account Number : ") ; scanf("%d",&no) ; { printf(" Account Number : %d ",s[m].no) ; printf(" Name : %s ",s[m].name) ; printf(" Deposit : %f ",s[m].dep) ; printf(" Withdraw Amount : ") ; scanf("%f",&aa) ; if (s[m].dep < aa+20) //500 minimum { printf(" CANNOT WITHDRAW YOUR ACCOUNT HAS MINIMUM BALANCE (20 is minimum account balance) ") ; getch() ; } else { s[m].dep-=aa ; printf(" The Balance Amount in Account is : %f ",s[m].dep) ; } }

{ printf(" success ") ; getch( ) ; }

getch( ) ; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!