首页 > 编程 > C++ > 正文

C++第1次实验(提高班)项目四:模拟ATM

2019-11-06 09:16:37
字体:
来源:转载
供稿:网友

一.问题及代码

作    者:杨振宇完成日期:2017 年 2月 27 日*版 本 号:v1.0*对任务及求解方法的描述部分:  输入描述:模拟ATM机运行*问题描述:多菜单运行*程序输出:相应结果*问题分析:输入不同数字,输出不同结果*算法设计:采用多次条件语句进行控制#include<iostream>using namespace std;void main(){ int x1,x2,x3,x4,x5,x6,y; cout<<"杨氏银行欢迎您!"; cout<<"请输入密码:"; cin>>x1>>x2>>x3>>x4>>x5>>x6; if(x1==9&&x2==7&&x3==1&&x4==0&&x5==1&&x6==1) {  cout<<"1.查询"<<endl;  cout<<"2.取款"<<endl;  cout<<"3.存款"<<endl;  cout<<"4.转帐"<<endl;  cout<<"0.退出"<<endl;  cout<<"请输入功能选择:";  cin>>y;  if(y>=1&&y<=4||y==0)  {   cout<<"谢谢,您选择了"<<y<<"号功能"<<endl;  }  else  {   cout<<"error"<<endl;  } } else {  cout<<"error"<<endl; }

}

二.运行结果

三.心得体会

使用多条条件语句进行程序编辑,为自己以后编辑类似程序积累了经验。加油!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选