##C++代码
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
char d;
cin>>a>>b>>d>>c;
for (int f=0;f++;f<b)
{
cout<<d;
}
cout<<endl;
if (c==0)
{
for (int e=2;e++;e<a)
{
cout<<d;
for (int g=2;g++;g<b)
{
cout<<" ";
}
cout<<d<<endl;
}
}
else
{
for (int e=2;e++;e<a)
{
for (int g=0;g++;g<b)
{
cout<<d;
}
cout<<endl;
}
}
for (int f=0;f++;f<b)
{
cout<<d;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
char d;
cin>>a>>b>>d>>c;
for (int f=0;f<b;f++)
{
cout<<d;
}
cout<<endl;
if (c==0)
{
for (int e=2;e<a;e++)
{
cout<<d;
for (int g=2;g<b;g++)
{
cout<<" ";
}
cout<<d<<endl;
}
}
else
{
for (int e=2;e<a;e++)
{
for (int g=0;g<b;g++)
{
cout<<d;
}
cout<<endl;
}
}
for (int f=0;f<b;f++)
{
cout<<d;
}
return 0;
}
for (int f=0;f++;f<b)
{
cout<<'d';
}
这段代码语法错误了,for 循环中间的部分是循环条件。
for (int f;f=0;f<b)为什么要用这种表达?
你直接for(int f=0;f<b;f++)就好了吧
if (c=0)这种应该是错误语法,一般情况应该是if(c==0)