ATM自动取款机代码
#include <stdio.h>
#include <conio.h>
void main()
{
int y,z;
long x=1000;
int SelectKey,CreditMoney,DebitMoney;
int j=0,Password=0;
while( Password != 1234 )
{
if(j>= 3 )
return;
j++;
printf("Please input Password: ");
scanf("%d",&Password);
}
while(1)
{
do{
system("cls");
printf("=========================\n");
printf("| Please select key:| \n ");
printf("| 1. Quary |\n");
printf("| 2. Credit |\n");
printf("| 3. Debit |\n");
printf("| 4. Exit |\n");
printf("=========================\n");
scanf("%d",&SelectKey);
}while( SelectKey!=1 && SelectKey!=2 && SelectKey!=3 && SelectKey!=4 );
switch(SelectKey)
{
case 1:
system("cls");
printf("================================\n");
printf("| Your balance is $%6d |\n",x);
printf("| Press any key to return... |\n");
printf("================================\n");
getch();
break;
case 2:
do{
system("cls");
printf("==================================\n");
printf("| Please select Credit money: |\n");
printf("| 1. $50 |\n");
printf("| 2. $100 |\n");
printf("| 3. other |\n");
printf("| 4. Return |\n");
printf("==================================\n");
scanf("%d",&CreditMoney);
}while( CreditMoney!=1 && CreditMoney!=2 && CreditMoney!=3 && CreditMoney!=4 );
switch(CreditMoney)
{
case 1:
system("cls");
printf("=========================================\n");
printf("| Your Credit money is $50,Thank you!|\n");