(Solved) : Write Program Main Function Calls Following Functions Defined Main Allow User Enter Param Q44006001 . . .
C++ help! can you solve A-C using Visual Studio?Write program with a main function that calls all the following functions defined below. In the main, allow the user to enter in the parameters needed for each function. In turn have the main receive the return value(s) from each function and print it out. A. Raising a number n to a power p is the same as multiplying n by itself p times. Write a function called power() that takes a double value for n and an int value for p, and returns the result as a double value. Use a default argument of 2 for p. so that if this argument is omitted, the number n will be squared. B. Write a function called hms_to secs() that takes three int values —for hours, minutes, and seconds—as arguments, and returns the equivalent time in seconds (type long). In the main function, write logic to call this function repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns. The loop ends when the user enters a negative time for hour. c. Write a function called swap that interchanges two int values passed to it by the calling program. (Note that this function swaps the values of the variables in the calling program, not those in the function.) You’ll need to decide how to pass the arguments. Show transcribed image text Write program with a main function that calls all the following functions defined below. In the main, allow the user to enter in the parameters needed for each function. In turn have the main receive the return value(s) from each function and print it out. A. Raising a number n to a power p is the same as multiplying n by itself p times. Write a function called power() that takes a double value for n and an int value for p, and returns the result as a double value. Use a default argument of 2 for p. so that if this argument is omitted, the number n will be squared. B. Write a function called hms_to secs() that takes three int values —for hours, minutes, and seconds—as arguments, and returns the equivalent time in seconds (type long). In the main function, write logic to call this function repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns. The loop ends when the user enters a negative time for hour. c. Write a function called swap that interchanges two int values passed to it by the calling program. (Note that this function swaps the values of the variables in the calling program, not those in the function.) You’ll need to decide how to pass the arguments.
Expert Answer
Answer to Write program with a main function that calls all the following functions defined below. In the main, allow the user to …
OR