Thread: write a program to play dice rolling game between two player

  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,195
    Try This -

    Code:
    #include <stdio.h>
     
    int main(){
         printf("DO YOUR OWN HOMEWORK!\n");
         return 0;
         }

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What have you tried?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    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
    28,413
    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.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    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
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > 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.

  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, 03: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