Question: C + + Writing a program to create a single source code file that uses pointer variables and functions. write a program that reads 2

C++Writing a program to create a single source code file that uses pointer variables and functions.
write a program that reads 2 integers from the user and calls 3 different functions to do the following:
void swapArgs(int *, int *) function that takes 2 pointers to integers and swaps the integers read in main().
void divideArgs(int *, int *) function that takes 2 pointers to integers and stores the integer quotient in the first pointer parameter and the remainder in the second pointer parameter.
void powerArgs(int *, int *) function that takes 2 pointers to integers, raises the first integer to the power of the second integer, and stores the result in the first integer. You may NOT use the pow() function to do this, you must use a loop to calculate the result. Recall, any number raised to the 0 power is 1. If the power is a negative number, do not calculate any result. See sample runs below.
** sample run:
Enter integer 1: 3
Enter integer 2: 17
Before call to swapArgs a: 3 b: 17
After call to swapArgs a: 17 b: 3
After call to divideArgs a: 5 b: 2
After call to powerArgs a: 25 b: 2
Goodbye!
Enter integer 1: 2
Enter integer 2: 10
Before call to swapArgs a: 2 b: 10
After call to swapArgs a: 10 b: 2
After call to divideArgs a: 5 b: 0
After call to powerArgs a: 1 b: 0
Goodbye!
Enter integer 1: -10
Enter integer 2: 3
Before call to swapArgs a: -10 b: 3
After call to swapArgs a: 3 b: -10
After call to divideArgs a: 0 b: 3
After call to powerArgs a: 0 b: 3
Goodbye!
Enter integer 1: 0
Enter integer 2: 0
No operations performed!
Enter integer 1: -2
Enter integer 2: -9
Before call to swapArgs a: -2 b: -9
After call to swapArgs a: -9 b: -2
After call to divideArgs a: 4 b: -1
After call to powerArgs a: 4 b: -1
Goodbye!

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 Programming Questions!