Advertisement
ULK

Лабораторная №4

ULK
Oct 23rd, 2022
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 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<5) //ветка 1
  13.     {   if (x<-3) //AB
  14.         {  
  15.             if (x<-7)
  16.             {
  17.                 cout<<"x belongs to A";
  18.             }
  19.             else
  20.             {
  21.                 cout<<"x belongs to B";
  22.             }
  23.         }
  24.         else //CD
  25.         {
  26.             if (x<0)
  27.             {
  28.                 cout<<"x belongs to C";
  29.             }
  30.             else
  31.             {
  32.                 cout<<"x belongs to D";
  33.             }
  34.         }
  35.     }        
  36.     else //ветка 2
  37.     {   if (x<22) //EF
  38.         {  
  39.             if (x<11)
  40.             {
  41.                 cout<<"x belongs to E";
  42.             }
  43.             else
  44.             {
  45.                 cout<<"x belongs to F";
  46.             }
  47.         }
  48.         else //GH
  49.         {
  50.             if (x<55)
  51.             {
  52.                 cout<<"x belongs to G";
  53.             }
  54.             else
  55.             {
  56.                 cout<<"x belongs to H";
  57.             }
  58.         }
  59.        
  60.     }
  61.        
  62.     return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement