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

怎么后面多输出个东西?

幽灵嫖客 发布于 2007-07-13 21:32, 586 次点击

下面是源代码:
#include <iostream>
using namespace std;
#include <fstream>

void main()
{
char ch;
ofstream fout;
fout.open("a.txt");
ifstream fin;
fin.open("b.txt");
while(!(fin.eof()))
{
fin>>ch;
fout<<ch;
}

}
b.txt里面的内容是 what you want
输出怎么是wahtyouwantt

3 回复
#2
HJin2007-07-14 02:05
回复:(幽灵嫖客)怎么后面多输出个东西?
fin>>noskipws>>ch;

read more about i/o manipulators.

#3
LoveGood2007-07-14 02:39

#include <iostream>
#include <fstream>
using namespace std;

void main()
{
char ch;
ofstream fout;
fout.open("a.txt");
ifstream fin;
fin.open("b.txt");
fin>>ch;
while(!(fin.eof()))
{
fout<<ch;
fin>>ch;
}
}

#4
LoveGood2007-07-14 02:41
编程不要随便对齐~
1