C++ ဒေတာအမျိုးအစားများ
C++ ဒေတာအမျိုးအစားများ
Variables အခန်း တွင် ရှင်းပြထား သည့်အတိုင်း C++ ရှိ variable သည် သတ်မှတ်ထားသော data type ဖြစ်ရမည်-
ဥပမာ
int myNum = 5;
// Integer (whole number)
float myFloatNum = 5.99;
// Floating point number
double myDoubleNum = 9.98; // Floating point number
char myLetter = 'D';
// Character
bool
myBoolean = true; // Boolean
string myText = "Hello";
// String
အခြေခံဒေတာအမျိုးအစားများ
ဒေတာအမျိုးအစားသည် ကိန်းရှင်သိမ်းဆည်းမည့် အချက်အလက်အရွယ်အစားနှင့် အမျိုးအစားကို သတ်မှတ်သည်-
Data Type | Size | Description |
---|---|---|
int |
4 bytes | Stores whole numbers, without decimals |
float |
4 bytes | Stores fractional numbers, containing one or more decimals. Sufficient for storing 7 decimal digits |
double |
8 bytes | Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits |
boolean |
1 byte | Stores true or false values |
char |
1 byte | Stores a single character/letter/number, or ASCII values |
နောက်အခန်းများတွင် တစ်ဦးချင်းစီ ဒေတာအမျိုးအစားများအကြောင်း ပိုမိုလေ့လာနိုင်ပါမည်။