Relation Operator
Relation Operator- bu 2 yoki undan ko'p bo'lgan o'zgaruvchilarni qaysi biri katta,kichik,yoki tengligini bildirib beradi.
Relation Operator - Aloqa Operator. chap va o'ng tomonlardagi munosabat.
Natija har doim True yoki False.
True 1,False 0 qaytardi.
c,cpp tilida 0 dan boshqa har qanday qiymat True yani Rost deb hisoblanaldi.
Relation Opertor katta kichik va tenglik belgilari shu ko'rinishda keladi;
<,<=,==,>,>=,!=;
cpp
int a = 14;
int b = 78;
int c = a < b ;
< (Operator) - chap tomondagi o'ng tomondagidan kichik,ya'ni chap tomondagi o'zgaruvchi o'ng tomondagi o'zgaruvchidan kichik
Masalan;
#include <iostream>
using namespace std;
int main (){
<=(Operator) - chap tomondagi o'ng tomondagidan kichik yoki teng ya'ni chap tomondagi o'zgaruvchi o'ng tomondagi o'zgaruvchidan kichik yoki teng
Masalan;
cpp
#include <iostream>
using namespace std;
int main (){
int a = 6;
int b = 5 + b++;
int c = a >= b ;
cout << c;
return 0;
}
==(Operator) - chap tomon o'ng tomong teng ya'ni chap tomondegi o'zgaruvchi o'ng tomndegi o'zgaruvchiga teng;
cpp
include
using namespace std;
int main (){
int a = 4;
int b = 9 - 5;
int c = a == b ;
cout << c;
return 0;
}
(Operator) - o'ng tomon chap tomondan katta ya'ni o'ng tomondagi o'zgaruvchi chap tomondagi o'zgaruvchidan katta;
Masalan;
cpp
include
using namespace std;
int main (){
int a = 6;
int b = 9 - 7;
int c = a > b ;
cout << c;
return 0;
}
=(Operator) - o'ng tomon chap tomondan katta yoki teng ya'ni o'ng tomondagi o'zgaruvchi chap tomondagi o'zgaruvchidan katta yoki teng;
Masalan;
cpp
include
using namespace std;
int main (){
int a = 174;
int b = a - 87;
int c = a >= b ;
cout << c;
return 0;
}
!=(Operator) - chap va o'ng tomonlar bir xil emas ya'ni chap tomondagi o'zgaruvchi o'ng tomondagi o'zgaruvchi bilan bir xil emas ;
Masalan;
cpp
include
using namespace std;
int main (){
int a = 66;
int b = 47 + 19;
int c = a != b ;
cout << c;
return 0;
}
Top comments (0)