| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 839 人关注过本帖
标题:我的第一个C++程序
取消只看楼主 加入收藏
fydgo
Rank: 2
等 级:论坛游民
帖 子:57
专家分:10
注 册:2009-4-10
结帖率:73.33%
收藏
 问题点数:0 回复次数:0 
我的第一个C++程序
#include <fstream>
这是我写的第一个程序,很简单,但我不明白为什么从文件读不了数据,然后传送的文件out.dat呢?我是菜鸟~~~
int main()
{
    using namespace std;
    ifstream in_stream;
    ofstream out_stream;

    in_stream.open("D:\我的文档\桌面\in.dat");
    out_stream.open("D:\我的文档\桌面\out.dat");

    int first,second,third;
    in_stream>>first>>second>>third;
    out_stream<<"the sum of the first 3\n"
              <<"numbers in in.dat\n"
              <<"is"<<(first+second+third)
              <<endl;
    in_stream.close();
    out_stream.close();

    return 0;
}
我in.dat文件里的数字是
1
2
3
搜索更多相关主题的帖子: include numbers second 桌面 
2009-12-18 09:46
快速回复:我的第一个C++程序
数据加载中...
 
   



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

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