Question
Declare and initialize C++ variables of different types. Determine and print the storage size of each of the types. Use math library functions. Use a
Declare and initialize C++ variables of different types. Determine and print the storage size of each of the types. Use math library functions. Use a conditional expression. Tasks: 1. Declare and initialize variables of the following C++ types: a. char, unsigned char b. short int, unsigned short int c. int, unsigned int d. long int, unsigned long int e. long long int, unsigned long long int f. float, double g. string 2. Print the type name, identifier (i.e. variable name), initialized value, and storage size in bytes used by each of the above types. Use sizeof(). 3. Calculate xy for x = 2 and y = 0.5. Use the cmath library function pow(base, exponent). Print the operands and the result. 4. Accept a number from the user. Print a message saying if the number entered was positive, negative, or zero. 5. Save your program on your flash drive in a subfolder called lab2. Create a new subfolder for every assignment! 6. Zip your lab2 subfolder, including a screenshot of your program run, and submit the zip archive to Blackboard. Example Program Run: int j1 value -42 size 4 unsigned int j2 value 12345 size 4 2 ** 0.5 = 1.41421356237 Enter a number: -5 You entered a negative number!
Run the programm.\ Show a snip picture of the output
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