#include <iostream>
#include <stdexcept>
#include <limits>
using namespace std;

int main(){
	cout << "Student's Status \n";
	cout << "To exit => Grade >20 or Grade <0 \n\n";
	while (true) {
		try{
			double x;
			cout << "Grade = ";
			cin >> x;
			if (cin.fail()){
				throw invalid_argument("Error! You have to enter a number!");
			}
			if (x >= 0 && x<10){
				cout << "Failed \n\n";
			} else if (x >= 10 && x <=20){
				cout << "Passed \n\n";
			} else {
				cout << "The program is terminated!";
				break;
			}
		} catch (const invalid_argument& e){
			cin.clear(); 
            cin.ignore(numeric_limits<streamsize>::max(), '\n'); 
			cout << e.what() << endl << endl;
		}
	}
	return 0;
}
