#include using namespace std; int main() { FILE *fp1,*fp2; char ch; if ((fp1=fopen('s1.txt','r'))==NULL) { cout<<'can not open s1.txt\n'; return 0; } if ((fp2=fopen('d1.txt','w'))==NULL) { cout<<'can not open d1.txt\n'; return 0; } ch=fgetc(fp1); while(ch!=EOF) //判断是否读到文件结尾 { if((ch>='a')&&(ch<='z')) { ch=ch-32; } fputc(ch,fp2); //输出到文件中 ch=fgetc(fp1); } fclose(fp1); fclose(fp2); return 0; }

C++ 文件操作:将文本文件中的小写字母转换为大写字母

原文地址: https://www.cveoy.top/t/topic/okAy 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录