#include <iostream> using namespace std; int main ()
{ int choice; choice= 1,2,3,4,5;
cout<< "COME PLAY A GUESSING GAME WITH ME. "<< "PICK ONE ON THE FIVE NUMBERS BELOW \n"<< "1 2 3 4 5 \n"; cin>> choice ;
return 0;
}
So anyways I'm not taking a programing class this semester but I want to keep my mind sharp so I decided to make little games in the mean time. My game is a guessing game where you pick the lucky number. I heard of something called rand but I don't get could someone explain how I can make rand pick on of these 5 number randomly
_________________ As cold and empty as space. This is who I am.
Wed Mar 07, 2012 9:30 am
SS
Joined: Sat Aug 16, 2008 8:38 am Posts: 6670 Location: Darkest Antartica Country: Gender: Male
Skype: Thaiberium
Currently Playing: The Game
Not sure since I haven't programmed in a while. rand() generates a random number, run it through modulus of 5 to get a number between zero and four. All you need to do after that is add one to it.
_________________
Wed Mar 07, 2012 1:07 pm
luckycrime
Joined: Wed Mar 09, 2011 2:49 pm Posts: 457
Gender: Male
Currently Playing: Ball Breaker with your sister. it's a real game...
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum