其实应该不用这么复杂吧
```cpp
if(f!=0)
{
...
}
else
{
for(int i = 1; i <= a; i++)
{
for(int j = 1; j <= b; j++)
{
if(i==1||i==a||j==1||j==b) cout << c;
else cout << ' ';
}
cout << endl;
}
}
```
by thluogu @ 2023-12-13 18:08:14
@[pwq123](/user/1232825)
@[pwq123](/user/1232825)
@[pwq123](/user/1232825)
```cpp
#include<bits/stdc++.h>
using namespace std;
int a,b,f;
char c;
int main(){
cin>>a>>b>>c>>f;
if(f!=0)
{
for(int i=1;i<=a;i++)
{
for(int j=1;j<=b;j++)
{
cout<<c;
}
cout<<endl;
}
}
else
{
for(int i=1;i<=a;i++)
{
if(i=/*这里不太对*/1||i==a)
{
for(int j=1;j<=b;j++)
{
cout<<c;
}
cout<<endl;
}
else
{
cout<<c;
for(int j=1;j<=b-2;j++)
{
cout<<" ";
}
cout<<c<<endl;
}
}
}
return 0;
}
```
by FiraCode @ 2023-12-13 18:17:03
@[FiraCode](/user/528430) 懂了懂了,之前看半天就是没想到,谢谢大佬
by pwq123 @ 2023-12-14 15:46:22
确实,谢谢大佬
by pwq123 @ 2023-12-14 16:00:42