consider the following:
double number_value;
cin >> number_value;
If the user input 666+12
I know number_value will be only 666. (right?)
But is this a good pratice? I mean when it encounters the + sign, will there be a problem?
cause usually when I try to input a char into an int it kinda crash..
but with this code it seems to be fine?
code was made by stroustrup btw..



LinkBack URL
About LinkBacks



I don't see how this + sign could hurt your program, personally I would rather user if statements/loops/or switch statements to find out when a user wants to quit or if they entered a certain value.