Advertisement
ProgNeo

Untitled

Nov 15th, 2021
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. setlocale(LC_ALL, "rus");
  8. int A;
  9. cout << ("Введите A = ");
  10. while (!(cin >> A) || (cin.peek() != '\n'))
  11. {
  12. cin.clear();
  13. while (cin.get() != '\n');
  14. cout << ("Введите целое число: ");
  15. }
  16. if (A < 2) {
  17. cout << "F(A) = " << A;
  18. }
  19. else if (A >= 2 && A <= 3) {
  20. cout << "F(A) = " << 2;
  21. }
  22. else {
  23. cout << "F(A) = " << - A + 5;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement