ex10-3.cpp

来自「关于I/O流的基础实验源代码」· C++ 代码 · 共 23 行

CPP
23
字号
# include <iostream>
# include <fstream>
using namespace std;
void main()
{
	char ch;
	ifstream tfile("a.txt",ios_base::binary);
	if(tfile)
	{
		ofstream ofile("b.txt",ios_base::out);
		tfile.get(ch);
		while(!tfile.eof())
		{   ofile<<char(toupper(ch));
			tfile.get(ch);
			
		}
		ofile.close();
		cout<<"成功输出到b.txt"<<endl;
	}
	else 
		cout<<"不能打开a.txt文件"<<endl;
	tfile.close();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?