Advertisement
SkeptaProgrammer

Untitled

Oct 9th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. double Input(bool t) // t вспомогательная переменная для степени
  2. {
  3.     double input;
  4.     if (t)
  5.     {
  6.         while (!(cin >> input && input >= 0 && input < 7))
  7.         {
  8.             cout << "\nВвод некорректен. Повторите ввод: ";
  9.             cin.clear();
  10.             while (cin.get() != '\n');
  11.         }
  12.         while (cin.get() != '\n');
  13.     }
  14.     else
  15.     {
  16.         while (!(cin >> input && input >= 0))
  17.         {
  18.             cout << "\nВвод некорректен. Повторите ввод: ";
  19.             cin.clear();
  20.             while (cin.get() != '\n');
  21.         }
  22.         while (cin.get() != '\n');
  23.     }
  24.     return input;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement