Advertisement
SkeptaProgrammer

Untitled

Feb 25th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 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. }
  13. else
  14. {
  15. while (!(cin >> input && input >= 0))
  16. {
  17. cout << "\nВвод некорректен. Повторите ввод: ";
  18. cin.clear();
  19. while (cin.get() != '\n');
  20. }
  21. }
  22. return input;
  23. }
  24.  
  25.  
  26. void Input(double *a, int size)
  27. {
  28. double input=0;
  29. for (int i = 0; i < size; i++)
  30. {
  31. cout << i + 1 << "-го числа: ";
  32. while (!(cin >> input))
  33. {
  34. cout << "\nВвод некорректен. Повторите ввод: ";
  35. cin.clear();
  36. while (cin.get() != '\n');
  37. }
  38. a[i] = input;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement