test3.cpp

来自「这我们老师对是面向对象程序设计(清华大学出版社)一书制作的PPT」· C++ 代码 · 共 26 行

CPP
26
字号
#include<iostream.h>
#include<fstream.h>
#include<stdlib.h>
void main()
{ 
  char ch;
	ifstream ifile("abc.txt");
	ofstream ofile("abc1.txt");
	if(!ifile){cout<<"can't open file"<<endl;
	           exit(1);
	}
	if(!ofile){cout<<"can't open file"<<endl;
	           exit(1);
	}
    ifile.get(ch);
	while (!ifile.eof())
	{	if (ch>='A' && ch<='Z')
			ch+='a'-'A';
		ofile.put(ch);
		ifile.get(ch);

	}
	ofile.close();
	ifile.close();
	
}

⌨️ 快捷键说明

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