Dastur nima?



Download 1,08 Mb.
bet3/4
Sana07.04.2022
Hajmi1,08 Mb.
#533567
1   2   3   4
Bog'liq
2.1-M #039 ruza. C dasturlash tili asoslari

Additional Integer Types

  • Butun tipli o’zgaruvchilar
  • Butun sonlar ta’riflanganda ko’rilgan tiplar oldiga unsigned (ishorasiz) ta’rifi qo’shilishi mumkin. Bu ta’rif qo’shilgan butun sonlar ustida amallar mod 2n arifmetikasiga asoslangandir . Bu erda n soni int tipi hotirada egallovchi razryadlar sonidir. Agar ishorasiz k soni uzunligi int soni razryadlar sonidan uzun bulsa, bu son qiyjmati k mod 2n ga teng bo'ladi. Ishorasiz k son uchun ga –k amali 2n – k formula asosida hisoblanadi. Ishorali ya’ni signed tipidagi sonlarning eng katta razryadi son ishorasini ko’rsatish uchun ishlatilsa unsigned (ishorasiz) tipdagi sonlarda bu razryad sonni tasvirlash uchun ishlatiladi.
  • C++ supports several other integer types. The type short int, which may be written as just short,
  • represents integers that may occupy fewer bytes of memory than the int type. If the short type occupies
  • less memory, it necessarily must represent a smaller range of integer values than the int type. The C ++
  • standard does not require the short type to be smaller than the int type; in fact, they may represent the
  • same set of integer values. The long int type, which may be written as just long, may occupy more
  • storage than the int type and thus be able to represent a larger range of values. Again, the standard does
  • not require the long type to be bigger then the int type. Finally, the long long int type, or just
  • long long, may be larger than a long. The C ++ standard guarantees the following relative ranges of
  • values hold:
  • short int<= int<= long int <= long long int
  • unsigned short< unsigned < unsigned long < unsigned long long

Many computational tasks require numbers that have fractional parts. For example, the formula from mathematics to compute the area of a circle given the circle’s radius, involves the value p, which is approximately 3.14159. C++ supports such non-integer numbers, and they are called floating-point numbers. The name comes from the fact that during mathematical calculations the decimal point can move or “float” to various positions within the number to maintain the proper number of significant digits. The types float and double represent different types of floating-point numbers.

  • Floating-point Types
  • Haqiqiy tipli o’zgaruvchilar
  • Many computational tasks require numbers that have fractional parts. For example, the formula from mathematics to compute the area of a circle given the circle’s radius, involves the value p, which is approximately 3.14159. C++ supports such non-integer numbers, and they are called floating-point numbers. The name comes from the fact that during mathematical calculations the decimal point can move or “float” to various positions within the number to maintain the proper number of significant digits. The types float and double represent different types of floating-point numbers.
  • KONSTANTALAR. (CONSTANTS)
  • Konstanta bu o’zgartirish mumkin bo’lmagan qiymatdir. C++ tilida besh turdagi konstantalar ishlatilishi mumkin: butun sonlar, haqiqiy sonlar, simvollar, sanovchi konstantalar va nul ko’rsatkich.
  • 1. Ma’lumotlarning butun son turi.
  • 2. Ma’lumotlarning haqiqiy son turi:
  • 66. ,0 .12 , 3.14F 1.12e-12
  • 3. Simvolli konstanta.
  • ‘x’,’*’,’\012’,’\0’,’\n’
  • Sanovchi konstanta.
  • enum{one=1,two=2,three=3};
  • Nul ko’rsatkich.
  • NULL- ko’rsatkich yagona arifmetik bulmagan konstantadir.
  • In Listing 3.9 (scientificnotation.cpp), Avogadro’s number and the speed of light are scientific constants;
  • that is, to the degree of precision to which they have been measured and/or calculated, they do not vary. C ++ supports named constants. Constants are declared like variables with the addition of the const keyword:
  • const double PI = 3.14159;
  • Quyidagi jadvalda konstantalar chegaralari va mos tiplari ko’rsatilgan:
  • C++ dasturida amallar
  • Ko'p dasturlar ijro davomida arifmetik amallarni bajaradi. C++ dagi amallar quyidagi jadvalda berilgan.
  • Misol. k = m * 5 + 7 % n / (9 + x); Birinchi bo'lib m * 5 hisoblanadi. Keyin 7 % n topiladi va qoldiq (9 + x) ga bo'linadi.
  • Chiqqan javob esa m * 5 ning javobiga qo'shiladi. Qisqasini aytsak, amallar matematikadagi kabi. Lekin biz o'qishni osonlashtirish uchun va hato qilish ehtimolini kamaytirish maqsadida qavslarni kengroq ishlatishimiz mumkin. Yuqoridagi misolimiz quyidagi ko'rinishga ega bo'ladi.
  • k = ( m * 5 ) + ( ( 7 % n ) / ( 9 + x ) );
  • Amallar jadvali

Download 1,08 Mb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish