DEV Community

etibor2006
etibor2006

Posted on

Wart Operatorlari haqida ma'lumot.

BU operator 2 tamonlama ishlatiladigon masalalani ishlashimiz mumkin.Miaol uchun masalalar.

int yosh;
cin >> yosh;
(yosh <= 12 || yosh >= 50)? cout << "30% chegirma sizda bor": cout << "yoq";

Enter fullscreen mode Exit fullscreen mode
string pasport;
  int age;
  cout << "passportingiz bormi (bor yoki yoq kiriting)";
  cin >> pasport;
 cout << "yoshingizni kiriting" <<  endl;
  cin >> age;
  (pasport == "bor" && age >= 18)? cout << "sz saylash huquqiga egasiz" : cout << "saylash huquqiga ega emasiz";


Enter fullscreen mode Exit fullscreen mode
int a=10, b = 5;
   a < b ? cout << a : cout << b;

Enter fullscreen mode Exit fullscreen mode


cpp
// masala 1
int ogirlik;
cout << (ogirlik > 100);
cout << ogirlik;
// masala 2
int a;
cout << (a != 0);
// masala 5
cout << (a > 0 && a < 100);

// masala 3
int olma;
int apelsin;
cout << (olma != apelsin);

// masala 4
int x;
cout << (x == 0);

// masala 6
char javob;
cout << (javob != 'Y' || javob != 'y');

// masala 7
int z;
int y;
cout << (x > z) && (y > z);
// masala 8
int i = 5;
int j = 10;
int k = 15;
cout << (i==k/j);
// masala 9
cout << (k % i < k/i);




Enter fullscreen mode Exit fullscreen mode

Top comments (0)