Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Paladrone

Name: Anonymous 2006-12-21 8:33

Optimize this code bitches!

#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{

     long a,b,c,d,e,f;
     char exit;

     cout << "Please input a 5 digit paladrone number: ";
     cin >> a;

     b = a/10000;
     cout << b << endl;
     c = (a%10000/1000);
     cout << c << endl;
     d = (a%1000/100);
     cout << d << endl;
     e = (a%100/10);
     cout << e << endl;
     f = a%10;
     cout << f << endl;

     if (b == 0) {cout << "That isn't a 5 digit number";}
     else if (b != c){cout << "The first number doesn't match with the last";}
     else if (f != d) {cout << "The secound number doesn't match with the fourth";}
     else {cout << b << f << e << d << c << " is a paladrone";}     return 0;


}

Name: Anonymous 2006-12-27 12:54 (sage)

>>33
shorter:
print'is',(chop,$_==reverse)?'':' not',' a palindrome.'while<>

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List