#include <conio.h>
#include <iostream>
using namespace std;
int main() {
double a[100][100];
int n;
cout << "n: ";
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
cout << "massive: " << endl;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << a[i][j] << "\t";
}
cout << endl;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] == a[j][n - 1 - i]) {
cout << "Palindrom";
} else {
}
}
}
}
在上一个循环中,我无法在每一行中组织搜索。它要么只搜索 1,要么搜索所有不需要的东西。