For this part of the question, you will identify a suitable coding module for the use of command line arguments in C++ programs. You should consult your course text or Visual C++ documentation for more details on command line arguments.
The purpose of this question is to create a game similar to Bingo in which a player will input fve numbers (between 1 and 75 both inclusive) as command line arguments. The player wins when the fve numbers are found in the set of numbers randomly generated by the computer.
Open Visual C++ and create a project. Use your name and student number as the name of the project. Go to the Project Properties and under Confguration Properties click the Debugging option. Next to the command Argument enter fve numbers each associated with the fve chars {B, I, N, G, O}
B -- An integer from 1 to 15
I -- An integer from 16 to 30
N -- An Integer from 31 to 45
G -- An integer from 46 to 60
O -- An integer form 61 to 75
Figure Q3(a) shows an example of the Properties page. see image.
(a) Submit a screen shot of your project properties (similar to the one shown in Figure Q3(a)) with the appropriate numbers entered as the command line arguments.
Note: Student name and PI number should appear as the title of the property page e.g. Janice D1234765. The command line arguments should consist of fve integers e.g. 13 21 39 54 68
(b) Write a C++ program to read in the command line arguments and implement the game as follows:
The program reads in the command line arguments and displays the numbers.
The program needs to checks if the fve numbers are within the respective range. For if the command has the numbers 13 21 49 54 68, then an error message is displayed
The five numbers in the command line are: 13 21 49 54 68
49 is not within the correct range
Please enter five numbers in the command line in the respective range:
[1,15] [16,30] [31,45] [46,60] [61,75]
This is because 49 is the third number and it is not within the range from 31 to 45.
The program will generate the numbers 1 to 75 and shuffle them in a random order. Note that the rand() function may not be able to generate 75 nonduplicate numbers.
Display the number one at a time. If a number matches one of the five numbers in the command line, then display the letter that is associated to the number.
When five matches are found, the program ends with a congratulatory message. A sample run of the game is shown in Figure Q3(b). see image.