本帖最後由 侯宣仲 於 2024-9-11 19:55 編輯
- #include<bits/stdc++.h>
- using namespace std;
- ifstream ifs;
- ofstream ofs;
- int n;
- string str;
- int main()
- {
- ifs.open("read.txt");
- ofs.open("write.txt");
- cin>>n;
- for(int i=0;i<n;i++)
- {
- getline(ifs,str);
- for(int j=0;j<n;j++)
- {
- char c=str[j];
- if(j=0 || str[j-1]=' ')
- c-=32;
- cout<<c;
- ofs<<c;
-
- }
- cout<<endl;
- ofs<<endl;
- }
-
- return 0;
- }
複製代碼 |