#include
<iostream>
#include
<fstream>
using
namespace
std;
int
main()
{
char
tmp;
cout<<"Please
input
some
words(The
amounts
less
200
is
OK
else
will
lose
words):"<<endl;
ofstream
fout("test.txt");
while(cin.get(tmp))
{
if(tmp=='\n')
break;
if(tmp<='z'&&tmp>='a')
tmp=tmp-32;
fout<<tmp<<flush;
}
fout.close();
ifstream
fin("test.txt");
char
ch[200];
fin.getline(ch,200);
cout<<ch<<endl;
fin.close();
return
0;
}
干嘛非要用数组呢,c++的string字符串类型不更安全。
温馨提示:答案为网友推荐,仅供参考