我有一个文件,我想打印它的内容,但编译器无法识别以下内容:“/ . \ ____ \ \ _ -. " //"/ /__ - /__\ _\_ \ \" " \ /\ _ \ . /_ _ _ // //" " //_ / \ \ _\ \ - __ " " _ \ __ / - /\ " " \ -.\ \ \ /__/ ." "\ \ _ \ \ -。\ _ " "- \ _ __\ _\ `__ \ _ \ " "。/ ___// / / // _ / "
这是我的代码:
int main()
{
MenuText text;
string test = "Champion";
ofstream output("File.txt");
text.save(output);
fstream output ("File.txt");
text.load("File.txt");//This is an error.
text.print();
MenuText::MenuText()
{
mText = "Default";
}
MenuText :: MenuText(string text)
{
mText = text;
}
void MenuText::print()
{
cout<< "Story= " << mText<< endl;
cout<< endl;
}
void MenuText::save(ofstream& outFile)
{
outFile<< "/ . \ \____ \\ \\ _ -. "
//"/ /__ - \/\_______\\__\\__\ \"
"__\ /\ __ \ . \/_______//__//"
"__/\/__/ \ \ \_\ \ - ________ "
"___ ___ ______ \ \_____/ - /\ "
"__ \\ -.\ \\ ___\ \/_____/ ."
"\ \ \__\ \\ \-. \\ __\_ "
"- \ _\_______\\__\ `\___\\_____\ "
". \/_______//__/ /___//_____/ "<< mText<< endl;
cout<< endl;
outFile<< endl;
}
void MenuText::load(ifstream& inFile)
{
string garbage;
inFile>> garbage >> mText;
}