Question: C function help, two functions 11. Define a function called phone_password (prototype below) that reads a phone number and verifies it corresponds to the phone

C function help, two functions

C function help, two functions 11. Define a function called phone_password (prototype

below) that reads a phone number and verifies it corresponds to the

11. Define a function called phone_password (prototype below) that reads a phone number and verifies it corresponds to the phone number specified in the parameters. We define a phone number as a three digit integer, followed by a dash, followed by a four digits integer. For this problem: a. The function reads two integer values separated by a dash. The first integer represents the three digits of a phone number and the second the four digits; we are not using area code. b. The message "Enter phone in XXX-YYYY format:" will be displayed before reading the values. C. The function will compare the three digits and four digits values provided by the user against the three_digits and four_digits parameters. The function will keep asking for a phone as long as the values provided do not correspond to the parameters. Once they are the same, the function will end returning the number of attempts. Notice that the expected value represents one attempt. d. If the error_message parameter is true, the function will print the message "Invalid phone" after an invalid phone has been provided. e. You can assume users will provide valid data (integers) and a dash in between the integers. int phone_password (int three_digits, int four_digits, int error_message) Define a function called compute (prototype below) that computes either the sum or product of integers provided by the user. For this problem: The function reads integers values using scanf and the message "Enter value: "to read each value. The function will stop reading values when the user provides -1. If the sum_flag parameter is true, the function will compute and return the sum of the values; otherwise it will compute and return the product. If the print_flag parameter is true, the function will print the computed valued before returning the value. Use the message "Result: " followed by the computed valued. You can assume users will provide valid data integers) and the computation will not cause an overflow. Below we provided an example of using the function. Underlined text represents input and % the Unix prompt. Driver Output int main() { compute(0, 1); a.out Enter value: 4 Enter value: 5 Enter value: -1 Result: 20 return 0; int compute(int sum_flag, int print_flag)

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