Krit Th.
20+ yrs in programming professional markets, FMCG researchers, system analyst, university lecturers, broadcasting expert, and so on.
| Variable Types | Description | Memory Size |
|---|---|---|
| Int | The natural integer size for a machine - เลขจำนวนเต็ม | 4 bytes |
| long | Using a long number - เลขจำนวนเต็มที่มีจำนวนมากขึ้น | 4 bytes |
| long long | Using a long number - เลขจำนวนเต็มที่มีจำนวนมากขึ้น | 8 bytes |
| char | Stores a value of a single character - อักขระ 1 ตัวอักษร | 1 bytes |
| bool | Stores a value of true or false - จริงหรือเท็จ | 1 bytes |
| double | Double precision floating point - เลขทศนิยม | 8 bytes |
| long double | Using a longer precision floating point number that is more precise - เลขทศนิยมที่มีจำนวนมากขึ้น | 12 bytes |
| float | A single precision floating point value - เลขทศนิยม (น้อยกว่า double) | 4 bytes |
| void | No type and no storage assigned | - |
sizeof(variable)sizeof(type)int age;#include <iostream>
using namespace std;
int main() {
int price;
cout << price << endl;
}int price = 100;int price(100);int price{100};#include <iostream>
using namespace std;
int main() {
int price = 20;
cout << price << endl;
}#include <iostream>
using namespace std;
int price = 20;
int main() {
cout << price << endl;
}#include <iostream>
using namespace std;
int main()
{
double dblFarenheit, dblCelcius;
cout << "กรอกอุณหภูมิ (F): ";
cin >> dblFarenheit;
dblCelcius = (dblFarenheit - 32) * 5 / 9.0;
cout << "อุณหภูมิ (C): " << dblCelcius;
return 0;
}© Aj. Krit Th.
https://www.kritth.com
By Krit Th.