So I am new here, from what I have seen people here know what they're doing (not that my question is hard at all). So I am taking a programming class at my school. I have dabbled around with programming for a while, but never got very far. My teacher has given us some very simple programs to write, but I am a bit confused with this one. Here are the instructions to the assignment:


Write a C++ program that does the following:

Prompt the user to enter a day of the week as M (or m), T, W, R, F, S, and U for Monday through Sunday respectively. The user may enter an upper or lower case letter.

When the user enters a character, the program will echo the letter and output the name of the day of the week.

Provide an error trap that reads something like "you have entered an invalid letter; program aborting." Suggestion: use a switch statement with the error trap as the default condition. it is not necessary to prompt for multiple inputs.


So I know how to get the program to echo back the letter and everything. What I am a little confused about is: will I have to define all the letters as their respective day? eg. make M== Monday. And if I do have to do that how would I get it to accept Upper and Lower case letters and recognize that that letter is == monday ect. ect.

Also my main problem is the switch statement as the error trap. I have never used the switch statement, but I know what they do. I just don't really understand how I would use it for an error trap. Am I suppose to just make a case for every other letter in the alphabet other then M T W R F S and U? Even if I do that then what if the user enters a number instead of a letter?

I am sorry if I am not making much sense... It makes sense in my head, hopefully its not too jumbled..

Thanks for the help guys!