// Computing square with repeating and input control #include using namespace std; int main() { int ok; do { double valnum; cout << "Input number: "; cin >> valnum; if (cin.good()) cout << "Number " << valnum << " squared is " << valnum*valnum << endl; else { cin.clear(); cin.ignore(256,'\n'); cout << "Input error -- number required." << endl; } cout << " Continue (1) or close (0)?" << endl; cin >> ok; } while (ok == 1); }