The file winning_numbers.txt contains the winning numbers for the Powerball lottery since the beginning of the year. Below is a partial listing of the file winning_numbers.txt: Drawing Date Winning Numbers Prize 1/1/2022 6 12 39 48 50 7 2 500000000 1/3/2022 2 13 32 33 48 22 2 540000000 1/5/2022 6 14 25 33 46 17 2 630000000 1/8/2022 20 21 36 60 65 13 10 20000000 1/10/2022 14 17 18 21 27 9 2 27000000 1/12/2022 12 21 22 30 33 24 4 38000000 1/15/2022 3 18 37 51 59 13 2 48000000 1/17/2022 9 24 35 46 65 22 2 53000000 1/19/2022 11 15 43 55 61 10 3 62000000 1/22/2022 8 14 33 36 67 17 2 76000000 The winning numbers for the date 1/1/2022 are: 6 12 39 48 50 7 2 The numbers 6 12 39 48 50 are considered the 5 white balls (ping pong balls with numbers on them), 7 is considered the Powerball (color is a red ping pong ball with a number on it), and 2 is considered the Powerball Multiplier. A player of the game wants to know which white balls have been selected with the greatest frequency and which Powerball numbers have the greatest frequency. As an example, using 14 as the white ball from the above data set, 14 has a frequency of 3. For the Powerball number 17 would have a frequency of two. Write a C++ program to write to a file the frequency of occurrences for the white ball numbers and the Powerball numbers and their frequencies of occurrence. Both lists should be in ascending numerical order. Example of output to a file using the above data set: White Ball Frequency 1: 0 2: 1 ⋮ 14: 3 Power Ball Frequency 1: 0 2: 0 ⋮ 17: 2
The file winning_numbers.txt contains the winning numbers for the Powerball lottery since the beginning of the year. Below is a partial listing of the file winning_numbers.txt: Drawing Date Winning Numbers Prize 1/1/2022 6 12 39 48 50 7 2 500000000 1/3/2022 2 13 32 33 48 22 2 540000000 1/5/2022 6 14 25 33 46 17 2 630000000 1/8/2022 20 21 36 60 65 13 10 20000000 1/10/2022 14 17 18 21 27 9 2 27000000 1/12/2022 12 21 22 30 33 24 4 38000000 1/15/2022 3 18 37 51 59 13 2 48000000 1/17/2022 9 24 35 46 65 22 2 53000000 1/19/2022 11 15 43 55 61 10 3 62000000 1/22/2022 8 14 33 36 67 17 2 76000000
The winning numbers for the date 1/1/2022 are: 6 12 39 48 50 7 2 The numbers 6 12 39 48 50 are considered the 5 white balls (ping pong balls with numbers on them), 7 is considered the Powerball (color is a red ping pong ball with a number on it), and 2 is considered the Powerball Multiplier. A player of the game wants to know which white balls have been selected with the greatest frequency and which Powerball numbers have the greatest frequency. As an example, using 14 as the white ball from the above data set, 14 has a frequency of 3. For the Powerball number 17 would have a frequency of two.
Write a C++ program to write to a file the frequency of occurrences for the white ball numbers and the Powerball numbers and their frequencies of occurrence. Both lists should be in ascending numerical order. Example of output to a file using the above data set:
White Ball Frequency 1: 0 2: 1 ⋮
14: 3 Power Ball Frequency 1: 0 2: 0 ⋮ 17: 2
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images