C++作業2——【項目4】模擬ATM

代碼:
#include<iostream>
using namespace std;
int main()
{
    int password;
    const int ps=19840712;
    cout<<"格里達尼亞銀行歡迎你"<<endl;
    cout<<"請輸入密碼:";cin>>password;
    if(password!=ps)
        cout<<"您輸入的密碼不正確"<<endl;
    else
    {
        int number;
        cout<<"請選擇您需要的功能"<<"\n";
        cout<<"1.查詢"<<"\n"<<"2.取款"<<"\n"<<"3.存款"<<"\n"<<"4.轉賬"<<"\n"<<"0.退出"<<"\n";
        cin>>number;
        if(number==1)
            cout<<"謝謝,你選擇了1號功能";
        if(number==2)
            cout<<"謝謝,你選擇了2號功能";
        if(number==3)
            cout<<"謝謝,你選擇了3號功能";
        if(number==4)
            cout<<"謝謝,你選擇了4號功能";
        if(number==0)
            cout<<"謝謝,你選擇了0號功能";
        else
            cout<<"請輸入正確的功能序號";
    }
    return 0;
}
運行結果:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章