該怎麼辦?當你試圖回答這個問題的時候,試着更具體的noob。 沒有額外的細節。我得到一個錯誤C++文件處理錯誤
no match for operator<< in theFileIn<<number
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
int number;
string name;
ofstream theFileOut;
ifstream theFileIn;
theFileOut.open("Sansa.txt");
cout << "Enter the number and the name"<<endl;
while(cin>> number>> name)
{
theFileOut<<number<<" "<<name<<endl;
}
theFileOut.close();
theFileIn.open("sansa.txt");
while(theFileIn>>number>>name)
{
theFileIn << number<<" "<<name<<endl;
}
return 0;
}
我認爲這至少是今天發佈的關於文件輸入\輸出的第三個問題。請首先至少研究一下你的話題,因爲如果你自己至少做了一些研究,那麼你的問題都不可能找到答案。 –
您能複製粘貼您收到的確切錯誤信息嗎? – quandrei