for(inti=1;i<=n;i+) cout <<ch; cout <<endl; for(inti=1;i<=m-2;i++) { cout <<ch; for(intj=1;j<=n-2;j++) cout<<""; } cout <<ch; cout <<endl; for(inti=1:i<=n:i++) cout <<ch: cout <<endl: } 方法二: #include<bits/stdc++.h>/C+的万能头文件 using namespace std; int main() { int m,n,flag; char ch; cin>>m>>n>>ch>>flag;for(int i = 1; i <= n; i ++) { cout <<ch; } cout <<endl; for(int i = 1; i <= m-2; i ++) { cout <<ch; for(int j = 1; j <= n - 2; j ++) { cout << " "; } cout <<ch; cout <<endl; } for(int i = 1; i <= n; i ++) { cout <<ch; } cout <<endl; } } 方法二: #include <bits/stdc++.h> //C++的万能头文件 using namespace std; int main() { int m,n,flag; char ch; cin >> m >> n >> ch >> flag;