write a program to play dice rolling game between two player

This is a discussion on write a program to play dice rolling game between two player within the C++ Programming forums, part of the General Programming Boards category; write a program to play dice rolling game between two player --each player throws 3 dice in turns --the one ...

  1. #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~

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    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.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,737
    What have you tried?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    3
    I don't know how to write this,
    Could you give me some hinTS

    Thankyou~

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,737
    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
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #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~

  7. #7
    SRS
    SRS is offline
    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

  8. #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).

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    > 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.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 02:30 PM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  3. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM
  4. Dice Rolling Program help
    By courtesan in forum C Programming
    Replies: 3
    Last Post: 08-17-2005, 03:14 PM
  5. Replies: 1
    Last Post: 10-13-2004, 12:15 PM

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