#include <iostream> #include <vector> #include <algorithm> using namespace std; bool ili_eto_palindrom_ili_net( int chislo ) { bool ok = true; vector < char > agaga; for ( ' '; chislo; chislo /= 10 ) agaga.push_back( chislo % 10 ); for ( unsigned i = 0, j = agaga.size() - 1; i < j; ok = ok && agaga[ i++ ] == agaga[ j-- ] ); return ok; } int main() { int r = -1; for ( int x = 999; x; --x ) for ( int y = x; y; --y ) if ( ili_eto_palindrom_ili_net( x * y ) ) r = max ( r, x * y ); cout << r << endl; cin.get(); return 0; } The program multiplies two three-digit numbers from 100 to 999 and looks, this is a palindrome or not. And then from all palindromes finds the maximum. But when I run, the console is empty, what's wrong?
maxis a macro that is poorly defined. - andrybakusing namespace std;. If we wrotestd::max, then everything would be OK. - andrybak