Array Problem

This is a discussion on Array Problem within the C Programming forums, part of the General Programming Boards category; I have the following problem for my test and have no idea how to start =/ 1. Write a program ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    4

    Array Problem

    I have the following problem for my test and have no idea how to start =/

    1. Write a program to simulate a lottery drawing that uses balls numbered from 1 through 10. Assume that three balls are drawn at random. (Allow user input the number of lottery drawings to simulate). Your will simulate 10 lottery drawings. Store those data to a 10X3 array. The columns indicate the three balls in a lottery drawing. The rows indicate the 10 times drawings. In this exercise, You will need to calculate:

    1) What percentage of the time does the result contain three even numbers in the simulation? Write a function to finish this task.
    2) What percentage of the time does the number 5 occur in the three numbers in the simulation? Write a function to finish this task.
    3) Print out the original input (10 times drawings) properly on the screen. Then print out the percentage of time that the result contains three even numbers. Finally print out the percentage of the time that number 5 occurs in the three numbers in a lottery drawing.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    int main( void )
    {
        return 0;
    }
    Good place to start. Take it from there. Make it just do one problem at a time. Once you've got step 1 working, then try to do step 2. Well, in your case, step 1 (since you actually have 2 step 1s).


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    9
    Try looking up the functions rand() and srand(), as well as the use of the % mathematical operation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array problem
    By TomBoyRacer in forum C++ Programming
    Replies: 3
    Last Post: 04-08-2007, 11:35 AM
  2. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  3. Replies: 6
    Last Post: 02-15-2005, 10:20 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Need desperate help with two dimensional array problem
    By webvigator2k in forum C++ Programming
    Replies: 4
    Last Post: 05-10-2003, 02:28 PM

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