Realtion Operator haqida ma'lumot: Logical operator.
feyyame1
Posted on January 18, 2023
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.
int i = 5;
int j = 10;
int k = 15;
cout << ( i == k/j);
}
< 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:**
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
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";
}
💖 💪 🙅 🚩
feyyame1
Posted on January 18, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.