Thread: C++ program random number generator need help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    just do it for me
    Here you go. But I will only do this once,ok?

    Code:
    using namespace std;
    
    int main(int argc, char *argv[])
    {
    
    int dice1;
    int dice2;
    
    loop noOfRolls = 3; // Will make it do it 3 times
    
    int dicesum;
    
    do noOfRolls(3)
    (
    dice1 = rand() % 6 + 1;
    dice2 = rand() % 6 + 1;
    dicesum = dice1 + dice2
    
    cout << diesum;
    ) end noOfRolls(3)
    
    return 0;
    system("PAUSE");
    return EXIT_SUCCESS;
    }

  2. #2
    Registered User
    Join Date
    Oct 2007
    Posts
    8
    Thanks a lot but it does not run

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. random number gen & looping probelm :?
    By FoxeySoulSLayer in forum C++ Programming
    Replies: 1
    Last Post: 04-10-2009, 05:44 PM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. Random number + guessing game trouble
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-08-2007, 03:33 AM
  4. Generating a random number?
    By Konspiracy in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 12:33 AM
  5. How do I restart a random number sequence.
    By jeffski in forum C Programming
    Replies: 6
    Last Post: 05-29-2003, 02:40 PM