Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void fillName()
- {
- try
- {
- string name;
- cin >> name;
- if (name == "") throw "Error Empty line";
- cout << name << endl;
- }
- catch (const char* ex) { cout << ex << endl; };
- }
- void fillSurName()
- {
- try
- {
- string surname;
- cin >> surname;
- if (surname == "") throw "Error Empty line";
- cout << surname << endl;
- }
- catch (const char* ex) { cout << ex << endl; };
- }
- int fillAge()
- {
- try
- {
- int age;
- cin >> age;
- if (age > 0 || age >= 130) throw "Error age zero";
- return age;
- }
- catch (const char* ex) { cout << ex << endl; };
- return 0;
- }
- int main(){
- cout << fillAge() << endl;
- fillName();
- fillSurName();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment