DEV Community

NilufarBukhorova
NilufarBukhorova

Posted on • Updated on

 

C++da Variables and Data types

Data types

Int :

short, long, int (butun sonlar);

Real number :

float, double (kasr sonlar);

Character :

char (belgilar).

  • int age=14;
  • cout << age + 5 * 26 << endl; (144)
  • age= -15

Declaration

  • bu o'zgaruvchilarni e'lon qilish;
    • int son;

Assignment

  • bu o'zgaruvchiga qiymat o'zgartirish;
    • son=25;

Initalization

  • o'zgaruvchini e'lon qiish vaqtida birdaniga qiymat berish;
    • int boshqason = 16;

o'zgaruvchi nomi harflar, raqamlar va _ belgisidan iborat bo'lishi kerak.

  • int a=5;
  • int b=a;
  • int c=a+b;

int a;
float b; int a,c;
int c; float b,d;
float d;

Garbage value

  • declaration kiritilsayu, o'zgaruvchi miqdori kiritilmasa councilda chiqadigan taxminiy sonlar
   int a= 123.45 --> 123
   float a= 123 --> 123.00
Enter fullscreen mode Exit fullscreen mode

int vazn = (int)[majburlash] 120.123

int a=10;
int b= a+10;
int c= a+b;int d+ a+b+c;

a=b=c=d=60

cin >>

  • o'zgaruvchini o'qiydigan komanda

char --> Ascii table

  • char belgi= 'a'

  • cout << (char) (belgi/3) << endl; [majburlash]

iomanip

  • input output manipulation, kutubxona

setw()

  • o'zgaruvchi uchun print qlishda bo'sh katakchalar so'raydi
    • cout << setw(15) << son << endl; [by default right-aligned]
    • cout << left << setw (15) << son << endl;

setfill('')

setw() orqali ajratilgan yacheykalarni belgilar bn to'ldiradi.

setprecision

  • double sonlarda anilashtirish vazifani bajaradi, ya'ni kasr sondagi nuqtadan keyin keluvchi sonlarni ham chiqazib beradi. Faqat nuqtadan keyingisiga ta'sir qiladi.
    • 24.16

fixed

  • setprecision komandasi birgalikda ishlatiladigan komanda bo'lib, uqta jooyida qolsin degan ma'noda keladi.

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesnโ€™t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.