C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-11-2007, 07:54 AM   #1
Registered User
 
Join Date: Nov 2007
Posts: 3
write a program to play dice rolling game between two player

write a program to play dice rolling game between two player
--each player throws 3 dice in turns
--the one with the higher total points of the dice will be the winner of each round and get one mark
--the players can play as many rounds as they wish
--the winner will be one with the highest marks after finishing all the rounds

Thankyou for helping me~
JC041214 is offline   Reply With Quote
Old 11-11-2007, 07:57 AM   #2
Malum in se
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 3,188
Try This -

Code:
#include <stdio.h>
 
int main(){
     printf("DO YOUR OWN HOMEWORK!\n");
     return 0;
     }
__________________
Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.
abachler is offline   Reply With Quote
Old 11-11-2007, 07:57 AM   #3
C++ Witch
 
laserlight's Avatar
 
Join Date: Oct 2003
Location: Singapore
Posts: 11,339
What have you tried?
__________________
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar

Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
laserlight is offline   Reply With Quote
Old 11-11-2007, 08:01 AM   #4
Registered User
 
Join Date: Nov 2007
Posts: 3
I don't know how to write this,
Could you give me some hinTS

Thankyou~
JC041214 is offline   Reply With Quote
Old 11-11-2007, 08:08 AM   #5
C++ Witch
 
laserlight's Avatar
 
Join Date: Oct 2003
Location: Singapore
Posts: 11,339
Quote:
I don't know how to write this,
Could you give me some hinTS
What do you know? You have not shown us what you have tried, so there is nothing to hint except to hint that you should do your own homework.
__________________
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar

Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
laserlight is offline   Reply With Quote
Old 11-11-2007, 08:16 AM   #6
Registered User
 
Join Date: Nov 2007
Posts: 3
#include<stdio.h>
#include<stdilb.h>
#include<time.h>

main()
{
int x,y,z,sum1;
strand(time(NULL));
X=RANDOM(6)+1
Y=RANDOM(6)+1
Z=RANDOM(6)+1
sum1=x+y+z

Then I don't know how to complete~
JC041214 is offline   Reply With Quote
Old 11-11-2007, 11:32 AM   #7
SRS
3rd Week In C++
 
SRS's Avatar
 
Join Date: Nov 2007
Posts: 22
Please

Quote:
Originally Posted by JC041214 View Post
#include<stdio.h>
#include<stdilb.h>
#include<time.h>

main()
{
int x,y,z,sum1;
strand(time(NULL));
X=RANDOM(6)+1
Y=RANDOM(6)+1
Z=RANDOM(6)+1
sum1=x+y+z

Then I don't know how to complete~
1: Please use code tags for your code and indent properly. Many people will not reply just because it is harder to read.
2: No one will give you any help without an honest attempt at it first.
2a: Your code will not even compile and anyone who knows you can declare variables the way you did, knows that main has a keyword before it
2b: Anyone who knows to include 3 different things also knows to close every opening bracket with a closing bracket
2c: Your project requires input and output and you did not even make an attempt to prompt the user for anything or give any kind of feedback
2d: If this is the point which you are stuck, you did not mention compile error or attempt at it...
3: All of which leads me to believe you are just looking for someone to do your homework (which you might find, but i bet no one goes to work with you)
__________________
Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2
SRS is offline   Reply With Quote
Old 11-11-2007, 12:39 PM   #8
Registered Abuser
 
Join Date: Sep 2007
Location: USA/NJ/TRENTON
Posts: 127
Code:
#include<stdio.h>
#include<stdilb.h>
#include<time.h>
are those the headers your teacher has asked you to use? kinda fishy...

also:
Code:
// we prefer:
srand(time(0));

// to C-Style:
srand(time(NULL));
// in c++
As far as the whole thing goes, you're on the right track to getting a working program that does what you need. So really what's left is user prompting perhaps some looping, so you're far better off telling the people in this forum WHAT the actual problem is (BE MORE SPECIFIC, no one is going to complete your assignments for you).
sh3rpa is offline   Reply With Quote
Old 11-11-2007, 01:26 PM   #9
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,693
> Then I don't know how to complete~
1. what is RANDOM(), is that a function you've written based on rand() ?
2. You do the same thing again for player2, to calculate sum2, then compare both totals to see who won.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 11-11-2007, 02:31 PM   #10
Registered Abuser
 
Join Date: Sep 2007
Location: USA/NJ/TRENTON
Posts: 127
Listen to Salem, see what he's done for you?

He's basically starting a process that you would benefit greatly from....

PSEUDO-CODE!!!

(if you can't develop the pseudo-code for this simple a program, i think you need to seriously re-evaluate whether programming is for you or not).

Since the lack of reply from the OP i'm guessing that he's gone else-where to find someone to complete his work for him.
sh3rpa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Client-server system with input from separate program robot-ic Networking/Device Communication 3 01-16-2009 03:30 PM
2D RPG Online Game Project. 30% Complete. To be released and marketed. drallstars Projects and Job Recruitment 2 10-28-2006 12:48 AM
Game Independent Anti-cheat Project Needs Programmers GIA Project Lea Projects and Job Recruitment 3 09-15-2005 07:41 PM
Dice Rolling Program help courtesan C Programming 3 08-17-2005 03:14 PM
How to write program for Serial and USB which connect to external hardware? gogo C Programming 1 10-13-2004 12:15 PM


All times are GMT -6. The time now is 07:38 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22