LeonTexius @ 2024-07-18 16:27:39
最后两个点错了,求助大神
#include <bits/stdc++.h>
using namespace std;
int n;
int re = 1;
int nums;
int num[120];
int main() {
cin >> n >> nums;
while (nums != 0) {
num[re] = nums % 10;
re++;
nums /= 10;
}
for (int i = n; i >= 1; i--) {
switch (num[i])
{
case 0:
cout << "XXX";
break;
case 1:
cout << "..X";
break;
case 2:
cout << "XXX";
break;
case 3:
cout << "XXX";
break;
case 4:
cout << "X.X";
break;
case 5:
cout << "XXX";
break;
case 6:
cout << "XXX";
break;
case 7:
cout << "XXX";
break;
case 8:
cout << "XXX";
break;
default:
cout << "XXX";
break;
}
if (i != 1) {
cout << ".";
}
}
cout << "\n";
for (int i = n; i >= 1; i--) {
switch (num[i]) {
case 0:
cout << "X.X";
break;
case 1:
cout << "..X";
break;
case 2:
cout << "..X";
break;
case 3:
cout << "..X";
break;
case 4:
cout << "X.X";
break;
case 5:
cout << "X..";
break;
case 6:
cout << "X..";
break;
case 7:
cout << "..X";
break;
case 8:
cout << "X.X";
break;
default:
cout << "X.X";
break;
}
if (i != 1) {
cout << ".";
}
}
cout << "\n";
for (int i = n; i >= 1; i--) {
switch (num[i]) {
case 0:
cout << "X.X";
break;
case 1:
cout << "..X";
break;
case 2:
cout << "XXX";
break;
case 3:
cout << "XXX";
break;
case 4:
cout << "XXX";
break;
case 5:
cout << "XXX";
break;
case 6:
cout << "XXX";
break;
case 7:
cout << "..X";
break;
case 8:
cout << "XXX";
break;
default:
cout << "XXX";
break;
}
if (i != 1) {
cout << ".";
}
}
cout << "\n";
for (int i = n; i >= 1; i--) {
switch (num[i]) {
case 0:
cout << "X.X";
break;
case 1:
cout << "..X";
break;
case 2:
cout << "X..";
break;
case 3:
cout << "..X";
break;
case 4:
cout << "..X";
break;
case 5:
cout << "..X";
break;
case 6:
cout << "X.X";
break;
case 7:
cout << "..X";
break;
case 8:
cout << "X.X";
break;
default:
cout << "..X";
break;
}
if (i != 1) {
cout << ".";
}
}
cout << "\n";
for (int i = n; i >= 1; i--) {
switch (num[i]) {
case 0:
cout << "XXX";
break;
case 1:
cout << "..X";
break;
case 2:
cout << "XXX";
break;
case 3:
cout << "XXX";
break;
case 4:
cout << "..X";
break;
case 5:
cout << "XXX";
break;
case 6:
cout << "XXX";
break;
case 7:
cout << "..X";
break;
case 8:
cout << "XXX";
break;
default:
cout << "XXX";
break;
}
if (i != 1) {
cout << ".";
}
}
cout << "\n";
return 0;
}