Data type က variable ထဲမှာ ဘယ်လို data သိမ်းမလဲဆိုတာ သတ်မှတ်ပေးပါတယ်။ မှန်ကန်တဲ့ data type ရွေးတာက memory အသုံးပြုမှု၊ calculation accuracy နဲ့ code ဖတ်ရလွယ်မှုအတွက် အရေးကြီးပါတယ်။
cpp
#include <iostream>
#include <string>
using namespace std;
int main() {
int students = 35;
double averageMark = 82.75;
char section = 'B';
bool passed = true;
string course = "C++ Foundation";
cout << course << endl;
cout << "Students: " << students << endl;
cout << "Average: " << averageMark << endl;
cout << "Section: " << section << endl;
cout << "Passed: " << passed;
return 0;
}int က ကိန်းပြည့်၊ double က decimal number, char က စာလုံးတစ်လုံး၊ bool က true/false, string က စာသားအတွက် သုံးပါတယ်။ Student count လို decimal မလိုတဲ့ data ကို int သုံးတာ ပိုသင့်တော်ပါတယ်။
You should see
C++ Foundation Students: 35 Average: 82.75 Section: B Passed: 1Info
Money, grade average, measurement လို decimal တန်ဖိုးတွေမှာ double ကို float ထက် ပိုအသုံးများပါတယ်။