

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for determining the number, type, and order of values to be passed to given function headers in c++. Additionally, it includes the creation of a function named 'find_abs' that computes and displays the absolute value of a double-precision number, and a function named 'poly_two' that computes the value of a second-degree polynomial in c++. A working program is also provided for user input and output.
Typology: Lecture notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Question 1
For the following function headers, determine the number, type, and order (sequence) of the values that must be passed to the function:
(1) void factorial( int n)
(2) void price( int type, double yield, double maturity)
(3) void yield(int type, double price, double maturity)
(4) void interest(char flag, float price, float time)
Question 2
Write a function named find_abs that accepted a double-precision number passed to it, computes its absolute value, and display the absolute value. The absolute value of a number is the number itself if the number is positive, and the negative of the number if the number is negative.
Question 3
A second-degree polynomial in x is given by the expression ax^2 + bx + c , where a, b, and c are know numbers and a is not equal to zero. Write a C++
function named poly_two(a, b, c, x) that computes and returns the value of a second-degree polynomial for any passed integer values of a, b, c, and x. And also write a C++ working program to input a, b, c , and x. And print out the result of polynomial function.