关于文件输入输出的问题,求助!!
以下是出错的源代码:#include <iostream>
#include <fstream>
int main()
{
using namespace std;
char automoblie[50];
int year;
double a_price;
double d_price;
ofstream outFile;
outFile.open("carinfo.txt");
cout << "Enter the make and model of automobile: ";
cin.getline(automoblie, 50);
cout << "Enter the model year: ";
cin >> year;
cout << "Enter the origianl asking price: ";
cin >> a_price;
d_price = 0.913 * a_price;
cout << fixed;
cout.precision(2);
cout.setf(ios_base::showpoint);
cout << "make and model: " << automoblie << endl;
cout << "year: " << year <<endl;
cout << "was asking $" << a_price << endl;
cout << "now asking $" << d_price << endl;
outFile << fixed;
outFile.precision(2);
outFile.setf(ios_base::showpoint);
outFile << "make and mobel: " << automoblie << endl;//如果把这行除去,那么程序将成功执行,但是如果有这一行,将会提示出错,出错提示如下
outFile << "year: " << year << endl;
outFile << "was asding $" << a_price << endl;
outFile << "now asking $" << d_price << endl;
outFile.close();
return 0;
}
错误提示::E:\MY PROJECT\test009\test009.cpp(35) : error C2018: unknown character '0xa1'
E:\MY PROJECT\test009\test009.cpp(35) : error C2018: unknown character '0xa1'
Error executing cl.exe.
请教各位告诉,这是为什么?