文件输出操作
#include<fstream.h>#include<iostream.h>
int main()
{
ifstream inFile;
char item[80];
float cost;
inFile.open("data.txt");
cout<<"~~Collection of old radios~~"<<endl;
inFile>>item>>cost;
cout<<item<<" "<<cost<<endl;
inFile>>item>>cost;
cout<<item<<" "<<cost<<endl;
inFile.close();
cout<<"End of my act:"<<endl;
return 0;
}
我在同一文件夹下建立data。txt文件,并输入Motorola 59.59 Emerson 49.59 怎么程序输出是乱码?