Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PART 1: OUT OF RANGE ERROR (25 pts) In C++, the fundamental type of int on the PACE-ICE system uses 32 bits to represent an
PART 1: OUT OF RANGE ERROR (25 pts) In C++, the fundamental type of int on the PACE-ICE system uses 32 bits to represent an integer; however, you can extend this to 64 bits by using another fundamental type in C++ called long long. (Please note that these sizes can vary from platform to platform and are not guaranteed in the C++ standard which we will talk about in class.) I would like for you to write a program to calculate the results of 7" for n= 1, 2, 3, 4, ... using first the int type and then the long long type. Write an application showing the maximum value of n that can still store the results of 7" in an int, and long long variables without overflow. In addition to the main() function, to get practice using global functions, you need to create two global functions to calculate the value of 7". These two global functions need to have one input argument that is an int n. The first function needs to return an int, and the second needs to return a long long so that you can compare the ranges of these two data types. Your main() function and the two global functions need to be in a single file called lab1part1.cc. Your code should generate output to the terminal in the format shown below. This output format needs to continue until one-step past the roll over point. Think about how to detect the rollover. 7 to the n power results using int 7^1 = 7 7^2 = 49 7^3 = 343 (Continue this output until one past the rollover point.) 7 to the n power results using long long 7^1 = 7 7^2 = 49 7^3 = 343 (Continue this output until one past the rollover point.)
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