Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters: no parameters 3) Job: Input a double variable
Exercise#2: Pre-defined and User-defined functions Write the following functions: Function #1: 1) Name: Inputx 2) Parameters: no parameters 3) Job: Input a double variable and return its value Function #2: 1) Name: GetY 2) Parameters: double x 3) Job: calculate y using the formula below and return y. Function #3: 1) Name: OutputXY() 2) Parameters: double x, double y 3) Job: Output x and y as shown in the sample output. Limit the output of y to 5 decimal places. int main() ( Use the following main() to test your function. You only need to implement the three functions. If the function are Implemented correctly then you will get the correct output. double X, Y: y= X = InputX(): Y = GetY (X): -2x+cos (x) 5sin (2x) Output XX (X, Y); return 0; Sample input/output: Enter the value of x: 3.1 For 3.1 the value of y is 17.32865 Enter the value of x: 0.921 For 0.921 the value of y is -0.25678
Step by Step Solution
★★★★★
3.35 Rating (161 Votes )
There are 3 Steps involved in it
Step: 1
code include include include using namespace std double InputX double x cout Enter the value o...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