This forum is in archive mode. You will not be able to post new content.

Author Topic: [C++] basic i/o game  (Read 2106 times)

0 Members and 1 Guest are viewing this topic.

Offline gh0st

  • Sir
  • ***
  • Posts: 575
  • Cookies: 8
  • #DEDSec
    • View Profile
[C++] basic i/o game
« on: April 02, 2011, 04:40:28 AM »
well guys Im learning C++ and Ive just coded something very interesting and very basic compile and run it!  :D but you have to write it on a paper then u make the calculations have.

Code: [Select]
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int x;
    int y;
    int z;
    int w;

    cout << "Math game by gh0st - Evilzone.org\n";
    cout << endl;
    cout << "You need to follow the next steps that the program is gonna ask u to do ok?\n";
    cout << endl;
    cout << "Insert any number between 1 to 10 and press enter: \n";
    cin >> x;
    cout << endl;
    system("pause");
    cout << "Now multiply it by 2\n";
    y = x * 2;
    cout << endl;
    system("pause");
    cout << "Now the result is gonna be multiplied by 5\n";
    z = y + x;
    cout << endl;
    system("pause");
    cout << "Now the result is going to be divided by the number that you thought firstly\n";
    w = z / x;
    cout << endl;
    system("pause");
    cout << "Now the result will be summed by 5\n";
    w = w * 5;
    cout << endl;
    system("pause");
    cout << "If the result is 15 then you did a good operation, thanks for playing!\n";
    cout << endl;
    system("pause");
    return 0;
}

no matter what number u put the result will always be 15 :D
if you have another algebra way to make this trick just post it and then I code it
« Last Edit: April 13, 2011, 04:44:40 PM by gh0st »

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.