修改了一下不能存东西,不能打开东西的bug
cpp
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
double mem=10737418240;
map<string,string> jishiben;
string mulu="朴同学给你的一封信.memo\n";
int cntnote=1;
void start() {
srand(time(0));
for(int i=1; i<=100; i++) {
system("cls");
cout<<"\n\n\n";
cout<<" Park_01\n\n";
cout<<" 正在启动中...\n\n";
cout<<i<<"%";
for(int j=1; j<=i; j++) {
cout<<"▌";
}
Sleep(rand()%100+1);
}
Sleep(2000);
}
double calc() {
system("cls");
long long a,c;
char b;
cout<<"加减乘除,乘方运算\n";
cout<<"输入算式(只支持一个符号):";
cin>>a>>b>>c;
if(b=='+') return a+c;
else if(b=='-') return a-c;
else if(b=='*') return a*c;
else if(b=='/') {
if(c==0) {
cout<<" Error : Diveded by ";
return 0;
} else return a/c;
}
else if(b=='^') return pow(a,c);
else cout<<"符号错误\n";
}
void note() {
while(1) {
system("cls");
if(mem<=1024)
cout<<"当前剩余内存:"<<mem<<"B\n";
else if(mem<=1048576)
cout<<"当前剩余内存:"<<mem/1024 <<"KB\n";
else if(mem<=1073741824)
cout<<"当前剩余内存:"<<mem/1048576<<"MB\n";
else cout<<"当前剩余内存:"<<mem/1073741824<<"GB\n";
if(cntnote==0) {
cout<<"当前暂未记录\n";
} else {
cout<<mulu<<"\n";
}
cout<<"1.新建 2.打开 3.退出\n";
int j;
string temp;
cin>>j;
getline(cin,temp);
system("cls");
if(j==1) {
string biaoti;
cout<<"输入文件名:";
getline(cin,biaoti);
biaoti+=".memo";
mulu+=biaoti;
mulu+="\n";
cout<<"请输入你想输入的内容,回车结束:"<<"\n";
getline(cin,jishiben[biaoti]);
cout<<"正在保存...";
Sleep(1000);
mem-=jishiben[biaoti].size();
cntnote++;
}
if(j==2) {
cout<<"请输入文件名:";
string bt;
cin>>bt;
if(mulu.find(bt)!=-1) {
cout<<jishiben[bt]<<"\n";
} else cout<<"文件未找到\n",Sleep(1000);
system("pause");
}
if(j==3) return;
}
}
void man() {
jishiben["朴同学给你的一封信.memo"]="你好,我是朴同学。欢迎使用Park_01,祝你每天开心。Park_02已经在制作,希望你给我点个赞!" ;
while(1) {
cout<<"\n\n\n 这里是Park_01\n";
cout<<" 作者:朴同学\n";
cout<<" 你要做什么呢?\n";
cout<<" 1.计算器 2.记事本\n";
int n;
cin>>n;
if(n==1) cout<<calc();
if(n==2) note();
}
}
int main() {
start();
system("cls");
man();
}