MasterGun

Untitled

May 30th, 2020
42
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void fillName()
  2. {
  3. try
  4. {
  5. string name;
  6. cin >> name;
  7. if (name == "") throw "Error Empty line";
  8. cout << name << endl;
  9. }
  10. catch (const char* ex) { cout << ex << endl; };
  11. }
  12. void fillSurName()
  13. {
  14. try
  15. {
  16. string surname;
  17. cin >> surname;
  18. if (surname == "") throw "Error Empty line";
  19. cout << surname << endl;
  20. }
  21. catch (const char* ex) { cout << ex << endl; };
  22. }
  23. int fillAge()
  24. {
  25. try
  26. {
  27. int age;
  28. cin >> age;
  29. if (age > 0 || age >= 130) throw "Error age zero";
  30. return age;
  31. }
  32. catch (const char* ex) { cout << ex << endl; };
  33. return 0;
  34. }
  35. int main(){
  36.  
  37.  
  38.  
  39. cout << fillAge() << endl;
  40. fillName();
  41. fillSurName();
  42.  
  43.  
  44. return 0;
  45. }
RAW Paste Data