#include // This program will go into an infinite loop if we // enter a character that is not a valid integer. int main( void ) { int num; cout << "Enter a number: "; cin >> num; while ( num != 0 ) { int square = num * num; cout << "Square of " << num << " = " << square << endl; cout << "Enter a number (0 to quit) \n"; cin >> num; } } // The correct way to do it is like this: #ifdef SENSIBLE int main( void ) { int num; cout << "Enter a number: "; while ( cin >> num && num != 0 ) { int square = num * num; cout << "Square of " << num << " = " << square << endl; cout << "Enter a number (0 to quit) \n"; } } #endif