Operators and true folse .

shoxjaxon2008

Shoxjaxon2008

Posted on March 14, 2023

Operators and true folse .

Salom dasturchi bugun siz bilan operatorslardan eng qiyini hisoblangan ++ va -- operatorlari bilan tanishamiz va yana true folse nima ekanligi va qanday ishlashini ham tushuntirib o'taman .

Operators ++ va --
++ bu songa 1 qiyat qo'shadi .
-- bu sondan 1 qiymat ayiradi.
Tushuntirish
Masalan n son bor deylik . Agar ++ ishorasi n sondan oldin kelsa u birinchi hisoblanadi . ++ n kabi . Agar ++ ishorasi n sonidan keyin kelsa u barcha amallardan keyin bajariladi . n ++ kabi

                         _Tushuntirish(1)_
Enter fullscreen mode Exit fullscreen mode

Masalan a son bor deylik . Agar -- ishorasi a sondan oldin kelsa u birinchi hisoblanadi . -- a kabi . Agar -- ishorasi a sonidan keyin kelsa u barcha amallar bajarilgandan keyin bajariladi . n -- kabi .

ESLATMA
O'zgaruvchidan keyin kelgan ishoralar faqat qolib ketgan o'zgaruvchisi bilan qiymat o'zgartiradi .

Bu operatorslarni kod orqali tushunib olishingiz mumkin .

int main5() {

int a = 5 ; 
a ++ ;

cout << ++ a << endl ; // 7 
cout << a ++ << endl ; // 7 
cout << a -- << " " << a ++ << endl ;  // 8 //7
cout << ++ a << " " << a ++ << endl ;  // 9 //9
cout << a ++ << " " << ++ a << endl ;  // 10 // 12 
cout << -- a << " " << a -- << endl ;  // 11 // 11
cout << a ++ << " " << -- a ;  // 10 // 10 
// sonlari chiqadi . 
  return 0 ; 
} 
Enter fullscreen mode Exit fullscreen mode
                        _**True va Folse**_
Enter fullscreen mode Exit fullscreen mode

True va Folse - tarjimasi to'g'ri va hato
C ++ dasturlash tilida true bo'lsa ekranga 1 soni chiqadi .
Folse bo'lsa ekranga 0 soni chiqadi .

buni hozir o'zingiz ko'dda tushunib olishingiz mumkin .

// Description : Nsonini o'qing. AgarNsoni 20 va 30 orasida (20 va 30 ham kiradi) bo'lsa,1ni chop eting. Aks holda0ni chop eting.
#include <iostream> 
using namespace std ; 
int main() {

int n ; 
cin >> n ;
cout << ((n >= 20 && n <=30 )) ;

Enter fullscreen mode Exit fullscreen mode

Maqolamdan ko'p narsa bilib oldingiz degan umiddaman keyingi maqolamgacha hayr salomat bo'ling .

💖 💪 🙅 🚩
shoxjaxon2008
Shoxjaxon2008

Posted on March 14, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

while, do-while and for loops in C++
beginners while, do-while and for loops in C++

March 7, 2024

If statements in C++
beginners If statements in C++

March 4, 2024

Operators and true folse .
beginners Operators and true folse .

March 14, 2023