#include <iostream> #include <ctime> using namespace std; int main() { const int HEADS = 0; const int TAILS = 1; srand(flip(twice)) int val;= rand()%1; cout <<"coin toss game would you like to play??" << endl; cin >> const; cout << " heads or tails??? " << endl; cin >> val; return 0; }
HOW DO I CREATE A SIMPLE COIN TOSS GAMEHELP ME OUT AS SOON AS POSSIBLE
Page 1 of 1
2 Replies - 9009 Views - Last Post: 18 September 2008 - 11:30 AM
#1
HOW DO I CREATE A SIMPLE COIN TOSS GAME
Posted 18 September 2008 - 10:52 AM
Replies To: HOW DO I CREATE A SIMPLE COIN TOSS GAME
#2
Re: HOW DO I CREATE A SIMPLE COIN TOSS GAME
Posted 18 September 2008 - 11:20 AM
Congratulations on posting the same topic twice, seeing as its your first post(s)...
[rules]
[/rules]
Take note of the [code] tags
[rules]
[/rules]
Take note of the [code] tags
#3
Re: HOW DO I CREATE A SIMPLE COIN TOSS GAME
Posted 18 September 2008 - 11:30 AM
I'm not really sure what you want your game to do. Guess the value of a coin flip, let the user guess, or just output the result of a coin flip. As of right now it's not doing any of those. I can help you further once you elaborate.
For now let me point of some mistakes....
const is a reserved keyword you cannot cin to it
you are not storing the return value from your srand statement to anything, you are discarding it and will probably get compiler errors, I am not really sure what arguments you are passing it either.
When you modulo your random value by one you will always get a 0
For now let me point of some mistakes....
const is a reserved keyword you cannot cin to it
you are not storing the return value from your srand statement to anything, you are discarding it and will probably get compiler errors, I am not really sure what arguments you are passing it either.
When you modulo your random value by one you will always get a 0
Page 1 of 1