Agar siz char (belgi) turidagi o'zgaruvchini int (butun son) ga aylantirsangiz, kompyuter o'sha belgining ASCII jadvalidagi tartib raqamini ko'rsatadi.
'A' = 65
'a' = 97
'0' = 48 (raqamning o'z kodi bor!)
cpp
char harf = 'A';
int kod = harf;
cout << "Harf: " << harf << endl; // Natija: A
cout << "Kodi: " << kod << endl; // Natija: 65
Sondan Harfga (Int ➡️ Char)
Xuddi shunday, butun sonni belgi (char) turiga aylantirib, unga mos keladigan simvolni topish mumkin:
cpp
int raqam = 98;
char belgi = raqam;
cout << "Son: " << raqam << endl; // Natija: 98
cout << "Belgi: " << belgi << endl; // Natija: b
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Top comments (0)