# Include <stdio. h>
# Include <stdlib. h>
Int cunkuan (INT); // Deposit function
Void chaxun (INT); // query the Function
Int qukuan (INT); // withdrawal Function
Void password (); // change the password Function
// Variable Description: Mima initial password pass user input password newpass Change Password qrpass Confirm Password ckmoney deposit amount qkmoney withdrawal amount fmoney initial balance money card balance times withdrawal times
Void main ()
{
Int I = 0, j = 0, Mima = 000000, fmoney = 0, pass, money;
Char A, C;
Printf ("Enter your bank card password! (Initial password:/"000000/")/n ");
Scanf ("% d", & pass );
While (I <2)
{
If (pass = MIMA)
{
While (J! = 5)
{
System ("CLS ");
Getchar ();
Printf ("welcome to the ATM self-help system/n. Select the corresponding function in the main menu below... /N1. deposit/N2. query balance/N3. withdrawal/n4. Change Password/n5. exit/N ");
Scanf ("% d", & J );
Switch (j)
{
Case 1:
Do
{
Money = cunkuan (fmoney );
Fmoney = money;
Getchar ();
Printf ("continue? /"Y/" Continue deposit. Any other key is returned to the main menu ...");
Scanf ("% C", & );
} While (A = 'y' | A = 'y ');
Break;
Case 2:
Chaxun (fmoney );
Break;
Case 3:
Do
{
Money = qukuan (fmoney );
Fmoney = money;
Getchar ();
Printf ("continue? /"Y/" continue to withdraw money. Any other key is returned to the main menu ...");
Scanf ("% C", & C );
} While (C = 'y' | C = 'y ');
Break;
Case 4:
Password ();
Break;
Case 5:
Printf ("Thank you for using this ATM system! Goodbye! /N ");
Return;
Default:
Printf ("incorrect function selection! Please select again! Press enter to continue! /N ");
Getchar ();
}
}
}
Else
{
Printf ("Incorrect password! Enter again! /N ");
Scanf ("% d", & pass );
I ++;
}
}
If (I> = 2)
{
Printf ("Wrong Password 3 times on the day! Your bank card has been swallowed up! Please contact your bank with your ID card! (To ensure that your legitimate rights and interests are not infringed, please do not trust the phone number pasted next to it !) /N ");
Return;
}
}
Int cunkuan (INT fmoney1)
{
System ("CLS ");
Int ckmoney, money1;
Printf ("welcome to the deposit system! /N the system can only accept RMB 100 with a nominal value! The maximum deposit limit per time is RMB 5000! /N enter your deposit amount :");
Scanf ("% d", & ckmoney );
If (ckmoney <= 5000 & ckmoney % 100 = 0)
{
Money1 = fmoney1 + ckmoney;
Printf ("transaction successful! /N your deposit amount is % d.00 yuan, and the balance on your card is % d.00 yuan. /N ", ckmoney, money1 );
Return money1;
}
Else if (ckmoney> 5000)
{
Printf ("transaction failed! /N your credit limit for a single account exceeds RMB 5000! Please try again! /N ");
Money1 = fmoney1;
Return money1;
}
Else if (ckmoney % 100! = 0)
{
Printf ("transaction failed! /N at least one of the money you deposit is RMB not the nominal value of RMB 100! The ATM can only accept RMB 100 with a nominal value! Please try again! /N ");
Money1 = fmoney1;
Return money1;
}
}
Void chaxun (INT ye)
{
Char B;
Do
{
System ("CLS ");
Getchar ();
Printf ("welcome to the Balance inquiry system! /N your card balance is RMB % d.00 yuan/n continue? /"Y/" Continue, any other key is returned to the main menu... ", ye );
Scanf ("% C", & B );
} While (B = 'y' | B = 'y ');
}
Int qukuan (INT ye)
{
Int qkmoney;
Static int time = 0;
System ("CLS ");
Printf ("welcome to the withdrawal system! /N a maximum of RMB rmb2000 can be withdrawn from the teller machine at a time (only RMB with a nominal value of RMB 100 can be taken). A maximum of three withdrawals can be made every day. /N enter your withdrawal amount :");
Scanf ("% d", & qkmoney );
If (qkmoney <= ye & qkmoney <= 2000 & qkmoney % 100 = 0 & time <3)
{
Ye = Ye-qkmoney;
Printf ("transaction successful! /N your withdrawal amount is % d.00 yuan, and your card balance is % d.00 yuan. /N ", qkmoney, ye );
Time ++;
Return ye;
}
Else if (qkmoney> ye)
{
Printf ("transaction failed! /N your card balance is insufficient! /N. Try again! /N ");
Return ye;
}
Else if (qkmoney & gt; 2000)
{
Printf ("transaction failed! /N a maximum of RMB rmb2000 can be withdrawn from the ATM at a time! /N. Try again! /N ");
Return ye;
}
Else if (qkmoney % 100! = 0)
{
Printf ("transaction failed! /N the ATM can only provide RMB 100/n with a nominal value. Please try again! /N ");
Return ye;
}
Else if (Time> = 3)
{
Printf ("You have withdrawn more than 3 times a day! You cannot withdraw money within 24 hours! If you really need the money, please go to the bank counter to operate ");
Return ye;
}
}
Void password ()
{
Char D;
Do
{
System ("CLS ");
Int newpass, qrpass;
Printf ("welcome to the password change page/n Please enter your new password/N ");
Scanf ("% d", & newpass );
Printf ("confirm your new password/N ");
Scanf ("% d", & qrpass );
If (newpass = qrpass)
{
Printf ("password changed! The modified password is % d/N ", newpass );
}
Else
{
Printf ("password modification failed! The password you entered is inconsistent with the password you modified (your original password was not modified )! Please try again! /N ");
}
Getchar ();
Printf ("continue? /"Y/" Continue, other keys Return to the main menu ...");
Scanf ("% C", & D );
} While (D = 'y' | D = 'y ');
}