一个简单的系统模板c++

萌新创作不易,给个赞赞吧!

#include <bits/stdc++.h>
#include <windows.h>
char edit[100001][101][2];
int cnt = 0;
using namespace std;
int main() {
    Sleep(50);
    cout << "      waiting" << endl << "    ";
    for (int i = 1; i <= 12; i++) {
        Sleep(25);
        cout << "-";
    }
    cout << endl;
    cout << "    " << "K " ;
    Sleep(50);
    cout << "KING ready";
    cout << endl;
    Sleep(50);
    cout << "    hello!" << endl;
    Sleep(50);
    cout << "    A system by sunningli" << endl;
    Sleep(50);
    cout << "    powered by DEV-C++" << endl;
    Sleep(50); 
    while (1) {
        cout << "    exit    edit(1.1.0)(without space)        userinfo    openword    calc(1.1.0)" << endl;
        string a;
        cin >> a;
        if (a == "userinfo") {
            cout << "    LX-KKING-01" << endl;
            cout << "    LENOVO -XT" << endl;
        }
        if (a == "edit") {
            cnt++;
            int s = 0;
            while (cin >> edit[++s][cnt][1]) {
                if (edit[s][cnt][1] == '~') {
                    edit[0][cnt][1] = s;
                    break;
                }
            }
            cout << "    number:" << cnt << endl;
        }
        if (a == "exit") {
            cout << "    all things on this system will not stay there!" << endl;
            cout << "    exit?(yes/no)"; 
            string s;
            cin >> s;
            if(s=="yes"){
                exit(0);
            }
        }
        if (a == "openword") {
            int x;
            cout << "    number :";
            cin >> x;
            int cnnt=0;
            cout << "    ";
            for (int i = 1; i <= edit[0][x][1] - 1; i++) {
                if(cnnt==20){
                    cout << endl;
                    cout << "    ";
                    cnnt=0;
                }
                cout << edit[i][x][1];
                cnnt++;
            }
            cout << endl;
        }
        if (a == "calc") {
            unsigned long long a, b;
            cin >> a;
            char c;
            cin >> c;
            cin >> b;
            if (c == '+') {
                cout << "    "<< a + b;
            }
            if (c == '-') {
                cout <<"    "<< a - b;
            }
            if (c == '*') {
                cout << "    "<< a * b;
            }
            if (c == '/') {
                cout << "    "<<a / b;
            }
            cout << endl;
        }
    }
    return 0;
}

 这份代码有"编辑(edit)","calc(计算器),打开文档(openword)"等,构造了一个比较简单的小型操作系统

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值