一.問題及代碼
作 者:楊振宇完成日期: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; }}
二.運行結果三.心得體會
使用多條條件語句進行程序編輯,為自己以后編輯類似程序積累了經驗。加油!
新聞熱點
疑難解答
圖片精選