大家好,我在下面写的代码是一个日记项目,它仍处于早期阶段,所以当你运行它时,它假设告诉你输入一个日记条目,然后将它保存在一个文本中,但它没有被保存在文件请帮忙!!
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
ofstream wysla;
wysla.open("wysla.txt, ios::app");
int kaput;
string s1,s2;
cout<<"Please select from the List below"<<endl;
cout<<"1.New entry"<<endl;
cout<<"2.View Previous Entries"<<endl;
cout<<"3.Delete an entry"<<endl;
cin>>kaput;
switch (kaput)
{
case 1:
cout<<"Dear diary,"<<endl;
cin>>s1;
wysla<<s1;
wysla.close();
break;
}
return 0;
}