标题:关于文件输入输出的问题,求助!!
取消只看楼主
c453413516
Rank: 1
等 级:新手上路
帖 子:16
专家分:4
注 册:2010-12-5
结帖率:80%
已结贴  问题点数:20 回复次数:0 
关于文件输入输出的问题,求助!!
以下是出错的源代码:
#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.

请教各位告诉,这是为什么?
搜索更多相关主题的帖子: 源代码 
2011-06-04 20:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-341905-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.173729 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved