萌新创作不易,给个赞赞吧!
#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)"等,构造了一个比较简单的小型操作系统