Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code: #include void printHelp () { printf ( ); printf (a: a(x) = x*x ); printf (b: b(x) = x*x*x ); printf (c: c(x) =
code:
#includevoid printHelp () { printf (" "); printf ("a: a(x) = x*x "); printf ("b: b(x) = x*x*x "); printf ("c: c(x) = x^2 + 2*x + 7 "); printf ("q: quit "); } void a(float x) { float v = x*x; printf (" a(%.2f) = %.2f^2 = %.2f ", x, x, v); } // end function a void b(float x) { float v = x*x*x; printf (" a(%.2f) = %.2f^3 = %.2f ", x, x, v); } // end function b void c(float x) { float v = x*x + 2*x + 7; printf (" c(%.2f) = %.2f^2 + 2*%.2f + 7 = %.2f ", x, x, x, v); } // end function c int menu () { char selection; float x; printHelp (); scanf ("%s", &selection); if (selection == 'q') return 1; scanf ("%f", &x); if (selection == 'a') a(x); if (selection == 'b') b(x); if (selection == 'c') c(x); return 0; } // end function menu int main() { while (menu() == 0); printf ("... bye ... "); return 0; } // end main
(x/2) Create a new function, shrink (float x), that would divide the input value by 2 using the shown code as a template. Support your experimentation with screen captures of executing the new code.
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