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

TOP

返回列表