
please wait
switch
inside a bool
controlled while
loop. See here for an outline:http://www.cplusplus.com/forum/general/83524/#msg448244 |
default:
case to catch bad input, and one can use char
instead of int
in the switch.
if
statement. Stick to a single char
answer, use std::tolower
, don't worry about checking validity of a no answer.while
loop, use the results of the yes/no question with bool
variable in the condition of the while.do
loops - they can be error prone. Just because they always execute once should not be a primary reason for choosing them over a while
loop. All 3 loop constructs can be converted form 1 to another, maybe at the price of an extra variable.