HOW DO I CREATE A SIMPLE COIN TOSS GAME

HELP ME OUT AS SOON AS POSSIBLE

Page 1 of 1

2 Replies - 7091 Views - Last Post: 18 September 2008 - 11:30 AM Rate Topic: -----

#1 carrera21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 18-September 08

HOW DO I CREATE A SIMPLE COIN TOSS GAME

Post icon  Posted 18 September 2008 - 10:52 AM

#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;


}

Is This A Good Question/Topic? 0
  • +

Replies To: HOW DO I CREATE A SIMPLE COIN TOSS GAME

#2 homemade-jam  Icon User is offline

  • Gabe's Nemesis
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,300
  • Joined: 17-March 08

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
Was This Post Helpful? 0
  • +
  • -

#3 demiserealized  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 11-September 08

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1