Wednesday, June 9, 2010

New magical CPP (C++) program!

Hey guys,
 After a little experience in C++ program, i had developed a magical C++ program, which would find the number you thought! please try that program, or download it from My google group! (http://groups.google.com/group/express-cling/files)

 Source Code:

 #include
#include

using namespace std;

int main()
{string name;
int ans;
    cout<<"Please enter your name to continue!\n";
    getline(cin,name);
    cout<<"Welcome Mr./Ms./Mrs. "<<<"\n";
    cout<<"Welcome to the mathematical magical game!\n\n\n";
    cout<<"Following this you will see a list of numbers\n\nThink a number from among those numbers, and answer the following questions correctly!\n\n";
    cout<<"Line1  Line2  Line3  Line4   Line5\n";
    cout<<"1\t2\t4\t8\t16\n";
    cout<<"3\t3\t5\t9\t17\n";
    cout<<"5\t6\t6\t10\t18\n";
    cout<<"7\t7\t7\t11\t19\n";
    cout<<"9\t10\t12\t12\t20\n";
    cout<<"11\t11\t13\t13\t21\n";
    cout<<"13\t14\t14\t14\t22\n";
    cout<<"15\t15\t15\t15\t23\n";
    cout<<"17\t18\t20\t24\t24\n";
    cout<<"19\t19\t21\t25\t25\n";
    cout<<"21\t22\t22\t26\t26\n";
    cout<<"23\t23\t23\t27\t27\n";
    cout<<"25\t26\t28\t28\t28\n";
    cout<<"27\t27\t29\t29\t29\n";
    cout<<"29\t30\t30\t30\t30\n";
    cout<<"31\t31\t31\t31\t31\n\n\n";
    cout<<"Where were your NO. found?\n\nFor example:\n If your no. (say 22) then you must enter 235(i.e in lines 2 , 3 and 5 hope you understand!)\n\n";
    cin>>ans;
    switch(ans)
    {
        case 1: cout<<"You thought 1\n";
        break;
        case 2: cout<<"You thought 2\n";
        break;
        case 3: cout<<"you thought 4\n";
        break;
        case 4: cout<<"you thought 8";
        break;
        case 5: cout<<"you thought 16";
        break;
        case 12: cout<<"you thought 3";
        break;
        case 13: cout<<" you thought 5";
        break;
        case 14: cout<<"you thought 9";
        break;
        case 15: cout<<"you thought 17";
        break;
        case 1345: cout<<" you thought 29";
        break;
        case 145: cout<<" you thought 25";
        break;
        case 1245: cout<<" you thought 27";
        break;
        case 245: cout<<" you thought 26";
        break;
        case 25: cout<<"you thought 18";
        break;
        case 35:cout<<" you thought 20";
        break;
        case 345:cout<<" you thought 28";
        break;
        case 24: cout<<" you thought 10 ";
        break;
        case 124: cout<<"you thought 11";
        break;
        case 125: cout<<"you thought 19";
        break;
        case 134: cout<<"you thought 13";
        break;
        case 135: cout<<"you thought 21";
        break;
        case 123: cout<<"you thought 7";
        break;
        case 1234: cout<<"you thought 15";
        break;
        case 12345: cout<<"you thought 31";
        break;
        case 23: cout<<"you thought 6";
        break;
        case 234: cout<<"you thought 14";
        break;
        case 2345: cout<<"you thought 30";
        break;
        case 34: cout<<"you thought 12";
        break;
        case 45: cout<<"you thoght 24";
        break;
        default:
        cout<<"ERROR!(don't try to cheat me!) Else contact stylishrino007@gmail.com";
    }
    return 0;
}