guys please help out with this theory qns

Determine the BEST structure to use when you want to output various messages based on a code letter representing a person’s marital status (e.g., ‘m’ for married, ‘d’ for divorced, ‘w’ for widowed, etc).


1)series of if statements

2)if/else

3)switch

4)nested if/else within a switch

thanks
What do you think? Try your best educated guess.
Last edited on
i feel that is option 1 as is the most simplest of all. How about you? ;)
Don't you think that would be very repetitive? Sounds like a copy-paste-edit nightmare.
then is it switch?
Case'D'cout<<"divorced": ;
easier to edit and add other variables?
Don't forget a break though.

I would personally use an unordered map though.
I have not learn that, if only can choose from the 4 options whats your recommendation?
You had the right idea with using a switch statement ;)
Topic archived. No new replies allowed.