Question
C++ uses four types for integers or whole numbers: short, int, long, long long. There are three types for numbers with fractional part: float, double,
C++ uses four types for integers or whole numbers: short, int, long, long long. There are three types for numbers with fractional part: float, double, long double.]
Write a C++ program that displays the size of each of the above data types in bytes (seven data types).
You may use the following statement: //replace dataType with the above data types cout << "Size of integer is: " << sizeof(dataType) << " bytes" << endl;
C++ defines constants in the and header files that show the minimum and maximum values of the data types. For example, INT_MIN and INT_MAX are used for integers. In the same program, use the appropriate constants (you can find them in the book or online) to display the minimum and maximum for all the above data types (short, int, long, long long, float, double, long double). Make sure you write them with uppercase letters. Remember that you do not need to define them, they are already defined in the above libraries. You just need to include those libraries in your program. You may use the following statement: cout << "INT_MIN is: " << INT_MIN << endl; //displays the minimum value for an integer
Here is a sample run: Size of integer is: 4 bytes INT_MIN is: -2147483648
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started