#includeint main(void){ //提供变量 cmd balance(余额) deposit(存款) withdraw(取款) //利用while做死循环 int cmd; float balance=0.0f, deposit, withdraw; printf("------【陈大纯简单的银行存取款程序】请输入如下数字命令-----\n"); printf("操作命令: 0:清空, 1:存款 2:取款 3:查看余额 4:退出程序 \n"); while(1){ printf("输入操作命令:"); scanf("%d",&cmd); switch(cmd){ case 0: balance = 0.0f;break; case 1: printf("输入要存款金额:\n"); scanf("%f",&deposit); balance = balance+deposit; break; case 2: printf("输入要取款的金额:\n"); scanf("%f",&withdraw); balance = balance-withdraw; break; case 3: printf("当前存款余额:¥%.2f\n",balance); break; case 4: //退出主函数 结束运行 printf("------【已经退出程序】------\n"); return 0; default: printf("输入命令错误;请重试!\n"); } } return 0;}