Question
Please help by writing the following in C++, not repeating instructions that are already given. Also please use comments to explain the code! Thanks in
Please help by writing the following in C++, not repeating instructions that are already given. Also please use comments to explain the code! Thanks in advance.
---
This program offers an opportunity to use pointers and reference parameters. Write five functions (not including main) per the specifications below. Output the results in main() after each function call. Again, output the results of each function call in main().
1. Function One - void calculateDiscount(). Obtain the following data from your user in main(): listPrice and discountPercentage. Call calculateDiscount() to calculate the discounted price. Pass the discounted price back to main() via a reference parameter.
2. Function Two - void determineLarger(). Obtain the following data from your user in main(): intOne and intTwo. Call determineLarger() to determine the larger of the two numbers. Pass the larger of the two back to main() via a pointer parameter.
3. Function Three - bool compareArrays(). Obtain the following data from your user in main(): Populate two built-in arrays of strings. Call compareArrays() to determine if the arrays contain the exact same data. Send the bool result back to main() via a return value.
4. Function Four - void sortArrays(). Call sortArrays() with a built-in array of strings and a Class Template array object of strings. Sort both.
5. Function Five - void demoPtrTechniques(). Demonstrate the four ways to pass a pointer to a function.
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