注册 登录
编程论坛 C++教室

[求助]书上的源程序,编译出错!

sbivfh 发布于 2007-01-09 12:55, 374 次点击

#include<iostream>
#include<fstream>
using namespace std;
int main()
{
char filename[20];
cout<<"enter name for new files:";
cin>>filename;
ofstream fout (filename);
fout<<"for only your eyes!\n";
cout<<"Enter your secret number:";
float secret;
cin>>secret;
fout<<"your secret numbers is "<<secret<<"\n";
fout.close();
ifstream fin(filename);
cout<< "Here are the corrects of "<<filename<<":\n";
char ch;
while(fin.get(ch))
cout<<ch;
cout<<"done!";
fin.close();
return 0;
}


[此贴子已经被作者于2007-1-9 13:07:02编辑过]

4 回复
#2
smartwind2007-01-09 13:16
把fin改称file即可
#3
pinglideyu2007-01-09 21:43
我把你的源程序给运行了一下,发现没有错误呀?拜托,你在骗我们呀?~~~~~~~~~~~~~~~~~~~~~~~~~
#4
caiqiufu2007-01-09 22:20
是不是在耍我们哦
#5
一二三四五2007-01-10 09:33
可能是编译器的问题吧
他说出错了

1