sufe @ 2021-03-12 16:30:26
#include <iostream>
using namespace std;
void outa ()
{
cout<<"XXX";
cout<<"X.X";
cout<<"X.X";
cout<<"X.X";
cout<<"XXX";
}
void b ()
{
cout<<"...";
cout<<"...";
cout<<"...";
cout<<"...";
cout<<"...";
}
void c ()
{
cout<<"XXX";
cout<<"..X";
cout<<"X.X";
cout<<"X..";
cout<<"XXX";
}
void d ()
{
cout<<"XXX";
cout<<"..X";
cout<<"X.X";
cout<<"..X";
cout<<"XXX";
}
void e ()
{
cout<<"X.X";
cout<<"X.X";
cout<<"XXX";
cout<<"..X";
cout<<"..X";
}
void f ()
{
cout<<"XXX";
cout<<"X..";
cout<<"X.X";
cout<<"..X";
cout<<"XXX";
}
void g ()
{
cout<<"XXX";
cout<<"X..";
cout<<"XXX";
cout<<"X.X";
cout<<"XXX";
}
void h ()
{
cout<<"XXX";
cout<<"..X";
cout<<"..X";
cout<<"..X";
cout<<"..X";
}
void i ()
{
cout<<"XXX";
cout<<"X.X";
cout<<"XXX";
cout<<"X.X";
cout<<"XXX";
}
void j ()
{
cout<<"XXX";
cout<<"X.X";
cout<<"XXX";
cout<<"..X";
cout<<"XXX";
}
int main ()
{
int n;
cin>>n;
int a[n];
for(int i = 0; i < n;i++){
cin>>a[i];
}
for(int i = 0; i < n ; i++){
if(a[i] == 0){
outa;
}
if(a[i] == 1){
b;
}
if(a[i] == 2){
c;
}
if(a[i] == 3){
d;
}
if(a[i] == 4){
e;
}
if(a[i] == 5){
f;
}
if(a[i] == 6){
g;
}
if(a[i] == 7){
h;
}
if(a[i] == 8){
i;
}
if(a[i] == 9){
j;
}
}
return 0;
}
```cpp
by Scintilla @ 2021-03-12 16:32:30
变量重名,并且调用函数应该 h()
。
by Raymondzll @ 2021-03-12 16:39:51
调用函数没有加括号
by CGDGAD @ 2021-03-12 16:54:02
就算加了括号这个做法也是错的,建议看一下题解。
by _caiji_ @ 2021-03-12 17:13:09
怎么过的编译,-Wall
没警告的吗