DEV Community

Ezoza
Ezoza

Posted 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

Deklaration:
bu ozgaruvchilarni elon qilish;
son=25

Assignment
bu ozgaruvchiga qiymat ozgartirish
son=25

Initalization
ozgaruvchini elon qilish vaqtida birdaniga qiymat berish
int a=5
int b=a
int c= a+b
int a
float b; int a,c;
int c; float b,c;
float d;

Garbage value
ozgaruchi yaratilsayu unga qiymat berilmasa uning qiymati unixpacyted boladi (4 bayt)

Float
kasr-real sonli ozgaruvchi, lekin butun donlarni ham qabul qiladi va 1.0 korinishiga aylantiradi Nuqtadan keyin 6 ta son aniqligida ishlaydi: 0.123456

Implict coversion

yashirin ozgartirish jarayoni misol uchun int a=1,9 bergabda warning berib ogohlantiradi

cin
terminalga input malumotni kirtadi

double
floating data typega mansub-kasr sonli ozgaruvchi

Iomanip
representationni boshqaradigan kutuubxona

Top comments (0)