INF205/lab_1/4.cpp
2024-02-24 11:37:06 +01:00

24 lines
773 B
C++

#include <iostream>
int main()
{
std::cout << "Check size of datatypes:\n";
bool b;
std::cout << "bool:" + std::to_string(sizeof(b)) + "\n";
char c;
std::cout << "char:" + std::to_string(sizeof(c)) + "\n";
short s;
std::cout << "short:" + std::to_string(sizeof(s)) + "\n";
int i;
std::cout << "int:" + std::to_string(sizeof(i)) + "\n";
long l;
std::cout << "long:" + std::to_string(sizeof(l)) + "\n";
long long ll;
std::cout << "long long:" + std::to_string(sizeof(ll)) + "\n";
float f;
std::cout << "float:" + std::to_string(sizeof(f)) + "\n";
double d;
std::cout << "double:" + std::to_string(sizeof(d)) + "\n";
long double ld;
std::cout << "long double:" + std::to_string(sizeof(ld)) + "\n";
}