谁帮我作一下这道C语言题啊 给50分 谢谢呀!

来源:百度知道 编辑:UC知道 时间:2024/06/05 10:04:42
丛一个文本文件读取正文,将其中的小写字母转换成大写字母,大写字母转换成小写字母,其他字符不变,然后输出到另一个文本文件中保存。

假设你的那个文件为infile.dat输出文件为outfile.dat
#include<iostream>
#include<fstream>
#include<cctype>
using namespace std;
void main()
{
ifstream in_put;
ofstream out_put;
in_put.open("infile.dat");
if(!in_put)
{
cout<<"Input file opening failed!\n";
exit(1);
}
out_put.open("outfile.dat",ios::app);
if(!out_put)
{
cout<<"Output file opening failed!\n";
exit(1);
}
char next;
while(in_put>>next)
{
if(isupper(next))
out_put<<toupper(next);
else if(islower(next))
out_put<<tolower(next);
else
out_put<<next;
}
}
因为本人是学的C++;刚好写了一个,作为你的借鉴!!!

//输入文件为a.txt,输出文件为b.txt
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h&g