#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/oj5D 著作权归作者所有。请勿转载和采集!

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