I think you should probably try to write some code before asking for help though!
For reading in a value from the console you should use std::cin
. A bit of guidance, you could take a look at the STL std::map
class to help you prepare a mapping.
Alternatively you could just use a long list of if
statements or a switch
statement for cleaner code!
Example
if (c == 'o') std::cout << "October" << std::endl;
else if (c == 'n') ...
or
switch(c) {
case 'o':
std::cout << "October" << std::endl;
break;
case 'n':
...
}
Hope this sets you on the right direction!
0
solved How to write these conditions correctly so that they work in the console?