| How to stop the program when user enter 0? |
return 0; if you are inside int main, or you may call std::exit(0); from anywhere. |
|
cin<< value is false, which means that the user entered a bad value, or you hit end of file etc, or (2) the value that gets read is zero.&& is guaranteed to evaluate its left operand (cin << value) first.