Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c. 1) Implement the prototypes in selection.h. a. Write the function do_if() in the file called if.c b. Write the function do_switch() in the file
c. 1) Implement the prototypes in selection.h. a. Write the function "do_if()" in the file called if.c b. Write the function "do_switch()" in the file called switch.c Both functions accept 3 parameters. i. The first parameter represents one of the options below. 1. If the first parameter is anything but one of those values (the numbers 1, 2, or 3, your function should return -1. 2. Otherwise, call the function that they selected and pass it the second and third parameters. Your function should return the result. 3. Both functions do exactly the same thing, but you MUST use an if- statement to write the do_if() function, and you MUST use a switch statement to write the do_switch() function. 1. add_two(int num1, int num2) 2. subtract_two(int num1, int num2) 3. multiply_two(int num1, int num2) Submit Details Build Run Instructions Grades Rename Delete Copy File: work/selection.h Files o Terminal work/selection.h resource + lib 1 #ifndef FUNCTIONS_H 2 #define FUNCTIONS H 3 4 int do_if (int choice, int num], int num2) 5 int do switch(int choice, int num], int num2): 6 7 int add_two (int, int): 8 int subtract_two(int, int) 9 int multiply two (int, int): 10 11 endif 12 + asnlib + scripts + startercode work if.c. main.c selection.h + - ddd_v1_w_YNdp_633166@runweb23:$ switch.c utility.c
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