Advertisement
ULK

Лабораторная №4 (возможно правильно)

ULK
Oct 25th, 2022 (edited)
1,025
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 1 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int x;
  9.     cout<<"Insert your number: ";
  10.     cin>>x;
  11.    
  12.     if (x>22&&x<11) // not F
  13.     {
  14.         if(x>22&&x<55) //G or other
  15.         {
  16.             cout<<"x belongs to G";
  17.         }
  18.         else //EB or other
  19.         {
  20.             if((x>5&&x<11)or(x>-7&&x<-3)) //E or B
  21.             {
  22.                 if(x>5&&x<11)
  23.                 {
  24.                     cout<<"x belongs to E";
  25.                 }
  26.                 else
  27.                 {
  28.                     cout<<"x belongs to B";
  29.                 }
  30.             }
  31.             else //other if not A
  32.             {
  33.                 if(x>-7) //not A
  34.                 {
  35.                     if(x>0&&x<-3) //H or D if not C
  36.                     {
  37.                         if(x>55) //H
  38.                         {
  39.                             cout<<"x belongs to H";
  40.                         }
  41.                         else //D
  42.                         {
  43.                             cout<<"x belongs to D";
  44.                         }
  45.                     }
  46.                     else //C
  47.                     {
  48.                         cout<<"x belongs to C";
  49.                     }
  50.                 }
  51.                 else //A
  52.                 {
  53.                     cout<<"x belongs to A";
  54.                 }
  55.             }
  56.         }
  57.        
  58.     }
  59.     else
  60.     {
  61.         cout<<"x belongs to F";
  62.     }
  63.    
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement