Page 2 of 2

Re: Help on a game.

Posted: Tue Jun 02, 2009 6:43 pm
by resatti
Okay, check this out

Code: Select all

#include <string> 
#include <iostream>
using namespace std;

int main()

{
   // Variables.
   string input;
   float x = 0.0;
   float y = 0.0;
   float z = 0.0;

   // Main Function.
   system("TITLE The Number Game!");
   
   cout << "The Number Game!" << endl;
   cout << "To play the number game, enter a number between 1 and 10." << endl << endl;
   cin >> x;
   cout << endl << endl;
   cout << "Number entered: " << x << endl;
   cout << "Let's begin the game. You need to answer a series or questions using Y and N. These resemble Yes and NO."
      " You must use capitals. Here comes the first question." << endl << endl;

   cout << "Is " << x << "larger than five(5)?" << endl;

      cout << "Input your answer." << endl;
      cout << "Input your answer." << endl;
      cin >> input;

      if (input == "Y" && x > 5){
         cout << "Correct!";
      } else {
         cout << "Wrong.";
      }


   system("pause");
   return 0;

}
I also recommend a different tutorial:
-reconnetworks on YouTube
-Books like the following (forgive me if any of the titles are offensive):
-...For Dummies
-The Complete Idiots Guide to...
-Sam Teaches You ... in 24 hours/ 21 days/etc.
-Thompson Course Technology(Highly Recommended)