Your task here is to implement a fortune teller program. It will receive some inputs from the user and will tell them which type of C++ programmer they are.
😅 If you get stuck, discuss it in GitHub Discussions.
If you get lost while submitting homework, just watch the tutorial video again 😉
A C++ program that communicates with the user by using screams. It must:
- Print a welcome statement:
Welcome to the fortune teller program!
- Ask the user for their name:
Please enter your name:
- Read the name that the user inputs into the terminal when the user presses Enter
- Ask the user when they were born:
Please enter the time of year when you were born: (pick from 'spring', 'summer', 'autumn', 'winter')
- Ask for an adjective:
And read it from the terminal as the user presses Enter
Please enter an adjective:
- Ask for another adjective:
And read it from the terminal as the user presses Enter
Please enter another adjective:
- Print a new line followed by the sentence "Here is your description:" and a fortune telling generated by our code based on the inputs that the user provided. For example:
Igor, the fearless STL guru that finds errors quicker than the compiler
You will construct the message following this pattern:
<NAME>, the <ADJECTIVE> <NOUN> that <ENDING>
You read the name directly from the user input from point 2. above.
Read the two adjectives from the user inputs in 5. and 6. and store them in an array or vector. Use the modulo division by the size of the array of your adjectives on the length of the provided <NAME>
to get an index that you can use to get an adjective from your array of adjectives
That's where the information you got in 4. comes in handy. Use the time of year that the user provided as a key to get the noun from the following key/value pairs:
"spring" <-> "STL guru"
"summer" <-> "C++ expert"
"autumn" <-> "coding beast"
"winter" <-> "software design hero"
Store these three values in an array:
"eats UB for breakfast"
"finds errors quicker than the compiler",
"is not afraid of C++ error messages"
Retrieve one of them following the same procedure as when getting the <ADJECTIVE>
but modulo-divide by the size of this new array here
- Work with your fork of the homeworks repository
- Here is the folder structure for this homework with respect to your
homeworks
repository root:homeworks/
homework_2/
fortune_teller/
fortune_teller.cpp
<-- put your code here!