问题标题: liunux系统

0
0
已解决
刘添睿
刘添睿
高级光能
高级光能

一个简单的系统

#include<iostream>
using namespace std;
int main(){
    int mima,mimaa,xuanxiang,shuzi1,shuzi2;
    char zifu;
    cout<<"欢迎使用liunux系统"; 
    cout<<endl;
    cout<<"请输入密码"; 
    cin>>mima;
    cout<<endl;
    cout<<"正在开机……";
    cout<<endl; 
    cout<<"开机完成!";
    cout<<endl;
    cout<<"请输入密码:";
    cin>>mimaa;
    if(mimaa==mima){
        cout<<"密码正确";
    }else{
        cout<<"密码错误,无法使用!";
        return 0;
    }
    cout<<"按1进入计算器,按2关机";
    cin>>xuanxiang;
    if(xuanxiang==1){
        cout<<"此计算器仅支持 + - * / % 运算";
        cout<<endl;
        cout<<"请输入数字";
        cin>>shuzi1;
        cout<<"请输入第二个数字";
        cin>>shuzi2;
        cout<<"请输入您要对这两个数字进行的运算";
        cin>>zifu;
        if(zifu=='+'){
            cout<<shuzi1+shuzi2;
        }else if(zifu=='-'){
            cout<<shuzi1-shuzi2;
        }else if(zifu=='*'){
            cout<<shuzi1*shuzi2;
        }else if(zifu=='/'){
            cout<<shuzi1/shuzi2;
        }else if(zifu=='%'){
            cout<<shuzi1%shuzi2;
        }else{
            cout<<"对不起,此计算器无法进行此类运算";
        }
    }
    if(xuanxiang==2){
        cout<<"正在关机";
        cout<<"关机完成,再见,期待您回来!";
    }
    return 0;
}

可以复制到Codebloks或Dev-C++


0
我要回答