0% found this document useful (0 votes)
13 views2 pages

Code

The document is a C++ program that displays information about various data types, including their sizes and value limits. It covers integer types (char, short, int, long, long long), floating-point types (float, double, long double), and unsigned integer types. Each type's size in bytes, minimum, and maximum values are printed to the console.

Uploaded by

mohyasmin888
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Code

The document is a C++ program that displays information about various data types, including their sizes and value limits. It covers integer types (char, short, int, long, long long), floating-point types (float, double, long double), and unsigned integer types. Each type's size in bytes, minimum, and maximum values are printed to the console.

Uploaded by

mohyasmin888
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <iostream>

#include <climits> // For integer type limits


#include <cfloat> // For floating-point type limits

using namespace std;

int main() {
// Integer Types
cout << "Integer Types:\n";
cout << "----------------------------------------\n";
cout << "char:\n";
cout << " Size: " << sizeof(char) << " byte\n";
cout << " Minimum Value: " << CHAR_MIN << "\n";
cout << " Maximum Value: " << CHAR_MAX << "\n\n";

cout << "short:\n";


cout << " Size: " << sizeof(short) << " bytes\n";
cout << " Minimum Value: " << SHRT_MIN << "\n";
cout << " Maximum Value: " << SHRT_MAX << "\n\n";

cout << "int:\n";


cout << " Size: " << sizeof(int) << " bytes\n";
cout << " Minimum Value: " << INT_MIN << "\n";
cout << " Maximum Value: " << INT_MAX << "\n\n";

cout << "long:\n";


cout << " Size: " << sizeof(long) << " bytes\n";
cout << " Minimum Value: " << LONG_MIN << "\n";
cout << " Maximum Value: " << LONG_MAX << "\n\n";

cout << "long long:\n";


cout << " Size: " << sizeof(long long) << " bytes\n";
cout << " Minimum Value: " << LLONG_MIN << "\n";
cout << " Maximum Value: " << LLONG_MAX << "\n\n";

// Floating-Point Types
cout << "Floating-Point Types:\n";
cout << "----------------------------------------\n";
cout << "float:\n";
cout << " Size: " << sizeof(float) << " bytes\n";
cout << " Minimum Value: " << FLT_MIN << "\n";
cout << " Maximum Value: " << FLT_MAX << "\n\n";

cout << "double:\n";


cout << " Size: " << sizeof(double) << " bytes\n";
cout << " Minimum Value: " << DBL_MIN << "\n";
cout << " Maximum Value: " << DBL_MAX << "\n\n";

cout << "long double:\n";


cout << " Size: " << sizeof(long double) << " bytes\n";
cout << " Minimum Value: " << LDBL_MIN << "\n";
cout << " Maximum Value: " << LDBL_MAX << "\n\n";

// Unsigned Integer Types


cout << "Unsigned Integer Types:\n";
cout << "----------------------------------------\n";
cout << "unsigned char:\n";
cout << " Size: " << sizeof(unsigned char) << " byte\n";
cout << " Maximum Value: " << UCHAR_MAX << "\n\n";
cout << "unsigned short:\n";
cout << " Size: " << sizeof(unsigned short) << " bytes\n";
cout << " Maximum Value: " << USHRT_MAX << "\n\n";

cout << "unsigned int:\n";


cout << " Size: " << sizeof(unsigned int) << " bytes\n";
cout << " Maximum Value: " << UINT_MAX << "\n\n";

cout << "unsigned long:\n";


cout << " Size: " << sizeof(unsigned long) << " bytes\n";
cout << " Maximum Value: " << ULONG_MAX << "\n\n";

cout << "unsigned long long:\n";


cout << " Size: " << sizeof(unsigned long long) << " bytes\n";
cout << " Maximum Value: " << ULLONG_MAX << "\n\n";

return 0;
}

You might also like