1)#include <iostream>#include <string>#include <windows.h>using namespace std;int main(){ setlocale (LC_ALL,"Rus"); SetConsoleCP(1251); SetConsoleOutputCP(1251); cout <<"Введите строку: " <<endl; string str; getline (cin,str); for (int i = 0; i<=str.size()-1; i++) { if (str.at(i) == 'а') str.at(i) = 'А'; else if (str.at(i) == 'б') str.at(i) = 'Б'; } cout <<endl; cout <<"Результат: " <<endl; cout <<str <<endl; return 0;}
2)#include <iostream>#include <string>using namespace std;int main(){ setlocale (LC_ALL,"Rus"); SetConsoleCP(1251); SetConsoleOutputCP(1251); cout <<"Введите строку: " <<endl; string str; getline (cin,str); bool f = true; for (int i = 0; i<=(str.size()-1)/2; i++) { if (str.at(i)!=str.at(str.size()-1-i)) { f = false; break; } } cout <<"Результат: " <<endl; if (f) cout <<"палиндром" <<endl; else cout <<"не палиндром" <<endl; return 0;}