I just finished an exam that I bombed pretty hard. I just dont know where to begin on this stuff and would love some guidance. Below is the details of the exam.
- Write a program that asks a user to enter their full name. Their name including spaces must be stored in a single string. Declare the string with a maximum of 40 characters.
- Calculate the # of Characters (C) in the string holding the full name and generate a random number (bullseye) between 1 and C (seed random number generator with current CPU time).
- Send these numbers (C and bullseye) as input parameters to a function called Guess.
- Inside the Guess function ask the user to guess the bullseye number. If the user enters a number out of the range (smaller than 1 or larger than C), notify so and ask for the number again.
- Once the user enters a valid number (within the range), compare it to the bullseye number and return a value of 0 to the main function if the user guessed incorrectly or return a value of 1 to the main function if the user guessed correctly.
- Back in the main function, use the returned value from the Guess function to notify the user whether the guess was correct or not.
- Give the user 3 chances to guess the bullseye number.
The window should read like this...
Enter your full name:
Enter a guess between 1 and 15:
Your guess was incorrect
Another Chance...
Enter a guess between 1 and 15:
Your guess was incorrect
Another Chance...
Enter a guess between 1 and 15:
Your guess was incorrect
Press any key to continue...
Any help and advice is very appreciated.