Function with default argument value

Create the CPP file Lab8A-XXXXX.cpp where XXXXX are the last 5 digits of your ID.Write exactly two functions, a power(x,y) function and a print(text, number) function. The power(x,y) function returns an integer result that is calculated by raising a number x (integer) to a power y (integer).it is a short lab. details in docx
lab_a.docx

Unformatted Attachment Preview

Don't use plagiarized sources. Get Your Custom Essay on
Function with default argument value
Just from $13/Page
Order Essay

Lab A
Topic: Function with default argument value.
Create the CPP file Lab8A-XXXXX.cpp where XXXXX are the last 5 digits of your
ID.
Write exactly two functions, a power(x,y) function and a print(text, number) function.
The power(x,y) function returns an integer result that is calculated by raising a
number x (integer) to a power y (integer).
The second argument y (exponent) of the function can not exceed 100.
If the second argument exceeds 100, the function should return -1.
Your power(x,y) function must be able to take either 1 or 2 integer arguments using
default argument. Look at the main() code to infer what the default value should be.
You can use any function in the “cmath” library in your code.
The print(text, number) function is the only one that does output to the console.
Write the function prototypes above main() and write the full function definitions after
main().
Use this given main() code without change:
// Function Prototypes go here …………
//
int main()
{
int x = 3;
x = power(x, 3);
print(“Value of x after step 1 is “, x);
x = power(x, 2);
print(“Value of x after step 2 is “, x);
x = power(x);
print(“Value of x after step 3 is “, x);
x = power(x, 101);
print(“Value of x after step 4 is “, x);
x = power(3, -5);
print(“Value of x after step 5 is “, x);
x = 10;
x = power(x);
print(“Value of x after step 6 is “, x);
return 0;
}
// Function definitions go here …………
Program Output:
Value of x after step 1 is 27
Value of x after step 2 is 729
Value of x after step 3 is 729
Value of x after step 4 is -1
Value of x after step 5 is 0
Value of x after step 6 is 10
May I have your email address
If yes, please attach in code, thank you

Purchase answer to see full
attachment

Order a unique copy of this paper
(550 words)

Approximate price: $22

Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency

Order your essay today and save 15% with the discount code ESSAYHELP