首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

编译提示的有关问题

2012-05-22 
编译提示的问题[codeC/C++][/code]//该程序完成一项任务:把一段文字输出到文本文挡#include iostream#i

编译提示的问题
[code=C/C++][/code]

//该程序完成一项任务:把一段文字输出到文本文挡
#include <iostream>

#include <string>

#include <fstream>

using namespace std;

int main(){

string quote, speaker;

cout << "enter a quotation:\n";
getline(cin, quote);

//prompt the user for the quotation's author
cout << "enter the person to whom this quote is attributed:\n";
getline(cin, speaker);

//repet the quotation to the user
cout << "the following has been received...\n\n" << quote << "\n-" << speaker "\n\n";

//write the data to the file

//declaring a file object
ofstream fileOutput("quote.txt", ios::app);

if (fileOutput.is_open()){
fileOutput << quote << "-" << speaker << "\n";

fileOutput.close();
//print a message
cout << "the data has been written to the file!\n";

} else {
cout << "the file could not be opened!\n";
return 1;
}

//wait for the user to press enter or return
cout << "press enter or return to continue.\n";
cin.get();

return 0;
}


编译时提示 error C2143: syntax error : missing ';' before 'string'
  Error executing cl.exe.

  quote3.obj - 1 error(s), 0 warning(s)
请问各位高人,我怎么也找不出那个错误




[解决办法]
cout << "the following has been received...\n\n" << quote << "\n-" << speaker << "\n\n";
[解决办法]

C/C++ code
cout << "the following has been received...\n\n" << quote << "\n-" << speaker << "\n\n";
[解决办法]
楼上不能这么说。解决问题不问分多不多。

热点排行