Game Guides > Game FAQ >  

How do you enter 10 rem guesing game 20 let n equal 50 30 input guess a number from 1 to 100 ecxetera to make it a guessing game computer program

How do you enter 10 rem guesing game 20 let n equal 50 30 input guess a number from 1 to 100 ecxetera to make it a guessing game computer program
Well first you need to know what language you need to use, a compiler, and not use bad variables like 'n'.... heres a C++ program i wrote... not completely done yet though. You need to know what a do/while loop is, if statement, while loop, maybe a for loop, need to know how to use char, know how to generate a "random" number, the output, input stream, and how to declare a variable. pretty basic stuff.


/*
Guessing Game
Idiot Proof for numbers out of bounds
Throws up when characters are entered for integer input
Asks user if they want to play the game successfully.
Loops back after game is over asking if user wants to play again.
Randomized numbers
*/

#include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
char play;
cout << "Want to play guessing game? Y/N" <<endl;
cin >> play;

// looping the guessing game for confirming if user wanted to play
while ((play 'y'));
}


return EXIT_SUCCESS;
}