DEV Community

feyyame1
feyyame1

Posted on

Realtion Operator haqida ma'lumot: Logical operator.

Aloqa operatori.
chap va o'ng tomon o'rtasidagi munosabat
Natija har doim  to'gri yoki notog'ri
True 1ni, False esa 0ni qaytaradi.
c da 0 dan boshqa har qanday qiymat rost deb hisoblanadi.

Enter fullscreen mode Exit fullscreen mode
int i = 5;
  int j = 10;
  int k = 15;
  cout << ( i == k/j);
  }

Enter fullscreen mode Exit fullscreen mode
< chap tomoni o'ng tomonidan kichiqroq.
<= chap tomon kichiqroq yoki o'ng tomonga teng.
== chap tomon o'ng tomonga teng.
>= chap tomon o'ng tomondan katta yoki teng.
> chap tomoni o'ng tomonda kattaroq.
!= chap va o'ng tomonlari bir xil emas.

**unga misol:**

Enter fullscreen mode Exit fullscreen mode


cpp
int ogirlik;
cout << (ogirlik > 100);
cout << ogirlik ;

cout << ( a > 0 && a < 100);

cout << ( a > 0 && a <100);

int olma;
int apilsin;
cout << ( olma != apilsin);

int x;
cout << (x == 0);

    LOGICAL OPERATORI

Enter fullscreen mode Exit fullscreen mode


cpp
BIR YOKI BIR NECHTA SHARTLARNI SOLISHTIRISH VA ULARNING NOTO'G'RI EKANLIGINI ANIQLASH.



#include <iostream>
using namespace std;
int main (){
  int yosh;
  cin >> yosh;
   (yosh <=12 || yosh >=50) ? cout << "30 % li chegirma sizda bor": cout << " yoq";
  }

int main () {
  string pasport;
   int age;
  cout << " passportingiz bormi (bor yoki yo'q)" << endl;
  cin >> pasport;
  cout << "Yoshingizni kiriting" << endl;
  cin >> age ;
  (pasport == "bor" && age >=18)? cout << " siz saylash huquqiga egasiz" : cout << "saylash huquqiga ega emassiz";
  }










Enter fullscreen mode Exit fullscreen mode

Top comments (0)