返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. ifstream ifs;
  4. int n;
  5. ofstream ofs;
  6. string str;
  7. int main()
  8. {
  9.     cin>>n;
  10.     ifs.open("read.txt");
  11.     ofs.open("write.txt");
  12.     for(int i=0;i<n;i++){
  13.         getline(ifs,str);
  14.         for(int j=0;j<str.length();j++){
  15.             char c=str[j];
  16.             if(j==0 and str[j-1]==' '){
  17.                 c-=32;
  18.             }
  19.             cout<<c;
  20.             ofs<<c;
  21.         }
  22.         cout<<endl;
  23.         ofs<<endl;
  24.     }
  25.     return 0;
  26. }
複製代碼

TOP

返回列表