#include <iostream>
#include <string>
bool is_palindrome(const std::string& s) {
std::string r(s);
std::reverse(r.begin(), r.end());
return s == r;
}
int main() {
std::string s1,s2;
setlocale(LC_ALL, "Russian");
std::cout << "Введите число 1: ";
std::getline(std::cin, s1);
std::cout << "Введите число 2: ";
std::getline(std::cin, s2);
if (is_palindrome(s1)|| is_palindrome(s2))
std::cout << "Одно из введенных чисел является палиндромом " << std::endl;
else
std::cout << "Ни одно из введенных чисел не является палиндромом " << std::endl;
return 0;
}
скрин
Объяснение:
print ("a | b | c | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11")
for a in range (2):
for b in range (2):
for c in range(2):
print("%1d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%5d%5d" % (a,b,c,int(not a),int(not a or c),int(a and c),int(not(a and c)),int((not a or c)and(not(a and c))),int(not c),int(b or not c),int((not a or c)and(not(a and c))and(b or not c)),int(b and c),int(not(b and c)),int((not a or c)and(not(a and c))and(b or not c)and(not(b and c)))))
print()
print ("1 - не a, 2 - не a v c, 3 - a*c,4 - не(a*c), 5 - (не a v c)*(не(a*c)), 6 - не c, 7 - b v не c, 8 - (не a v c)*(не(a*c))*(b v не c)")
print ("9 - b*c, 10 - не(b*c), 11 - (не a v c)*(не(a*c))*(b v не c)*(не(b*c))")