- #include<bits/stdc++.h>
- using namespace std;
- ifstream ifs;
- ofstream ofs;
- string str;
- int n;
- int main()
- {
- cin>>n;
- ifs.open("read.txt");
- ofs.open("write.txt");
- for(int i=0; i<n; i++)
- {
- getline(ifs, str);
- for(int j=0, len=str.length(); j<len; j++)
- {
- char c=str[j];
- if(j==0 || str[j-1]==' ')
- c-=32;
- cout<<c;
- ofs<<c;
- }
- cout<<'\n';
- ofs<<'\n';
- }
- return 0;
- }
複製代碼 |