Question: (20 pts) Write a C++ program that first prints the maximum and minimum values for the signed and unsigned ints, longs, and shorts using the

(20 pts) Write a C++ program that first prints the maximum and minimum values for the signed and unsigned ints, longs, and shorts using the macros from the climits library, http://www.cplusplus.com/reference/climits. Notice there is not a minimum unsigned! You should just enter the numerical literal for this information, and make sure you print proper messages for each min and max you are printing.

I have solved this, It's followed by this Q down beloew

(62 pts) Now, write a program to calculate and print the maximum and minimum signed and maximum and minimum (which of course is a literal number, that you still need to assign!) unsigned number stored in n bytes, and store the result in a variable to print. You do not have to handle the user entering a number of bytes greater than 8.

Think about the equation from class and recitation to determine how many numbers can be represented in 8 bits with two possible choices for each bit. How are you going to express an exponent? In C++, you need to use a built-in function, pow(base, exp), from the cmath library.

For example:

#include

#include

using namespace std;

int main() {

int num = pow(2,3);

cout << 2^3 is: << num << endl;

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!