有大佬知道为什么只有四分吗
回复必关
#include<iostream>
using namespace std;
int n;
void zhong(int x){
for(int i = 1;i <= x;i++){
if(i == 1 || i == x){
cout << '|';
}else{
cout << '-';
}
}
}
void pin(int x){
for(int i = 1;i <= x;i++){
if(i == 1 || i == x){
cout << '|';
}else{
cout << 'x';
}
}
}
int main(){
cin >> n;
for(int j = 1;j <= n;j++){
if(j%2==0){
pin(n);
}else{
zhong(n);
}
cout << endl;
}
return 0;
}