Question: i need this in visual studio programming c only Lab4 Instructions: Your program should: Write a small program that calculates the sum and the difference
Lab4 Instructions: Your program should: Write a small program that calculates the sum and the difference of two integers with three user- defined functions: //takes two integer arguments and returns the sum of the two arguments int CalculateSum (int num1, int num2) //takes two integer arguments and returns the difference of the two arguments int CalculateDiffernece (int numl, int num2) //takes two integer arguments and two integer pointer arguments //1. calculate the sum and stores the result in sumptr //2. calculate the difference and store the result in diffPt void CalculateBoth(int numl, int num2, int sumPtr, int diffPtr) Call all three functions from main. Print all the results inside the function definitions (value at) and ALSO print the results again back in the main function after the function has been called. Main function logic (and hints): 1. Declare variables num1, num2, sum1, diff1, sum2, diff2 2. Ask and get 2 numbers from the user (num1 and num2) 3. Pass num1 and num2 to the function calculateSum and it will return the sum to the variable sum 1 4. Print sum1 onto the screen 5. Pass num1 and num2 to the function CalculateDifference and it will return the difference to the variable dif 6. Print diff1 onto the screen 7. Pass num1 and num2 and "address of sum2 and "address of diff2 to the function CalculateBoth 8 Print sum2 and dif12 results onto the screen CalculateBoth function logic (and hints): Calculate the sum of num1 and num2 and store the result in the "value at" sumPt Print the value at sumPtr ont the screen Calculate the difference of num1 and num2 and store the result in the "value at" diffPtr Print the "value at diffPtr ont the screen //the function has a void return type
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
