#include <iostream> using namespace std; while (true) { int num; cin >> num; if (num >=1 && num <= 20) break; else cout << "please input again: " << endl; }