3 回答
TA贡献27条经验 获得超13个赞
//模拟ATM机
#include<stdio.h>
main()
{
printf(
" |===============================================|\n"
" | Please select key: |\n"
" | 1. Quary |\n"
" | 2. Credit |\n"
" | 3. Debit |\n"
" | 4. Return |\n"
" |===============================================|\n"
);
int i,j,k;
scanf("%d",&i);
switch(i)
{
case 1:
printf(
" |===============================================|\n"
" | your balance is 1000. |\n"
" | Press any key to return... |\n"
" |===============================================|\n"
);
break;
case 2:
printf(
" |===============================================|\n"
" | Please select Credit money: |\n"
" | 1. 50 |\n"
" | 2. 100 |\n"
" | 3. return |\n"
" |===============================================|\n"
);
scanf("%d",&j);
switch(j)
{
case 1:
printf(" your Credit money is $50,thank you !\n"
"Press any key to retuen...\n");
break;
case 2:
printf(" your Credit money is $100,thank you !\n"
"Press any key to retuen...\n");
break;
case 3:
printf("thank you for your using !\n"
"good bye\n");
break;
}
break;
case 3:
printf("Please select debit money:\n"
" 1.$50\n"
" 2.$100\n"
" 3.$500\n"
" 4.$1000\n"
" 5.return\n"
);
scanf("%d",&k);
switch(k)
{
case 1:
printf("your debit money is $50,thank you\n"
"Press any key to return\n");
break;
case 2:
printf("your debit money is $100,thank you\n"
"Press any key to return\n");
break;
case 3:
printf("your debit money is $500,thank you\n"
"Press any key to return\n");
break;
case 4:
printf("your debit money is $1000,thank you\n"
"Press any key to return\n");
break;
case 5:
printf("thank you for your using !\n"
"good bye\n");
break;
}
}
}
- 3 回答
- 0 关注
- 1619 浏览
添加回答
举报