Docsity

Function Parameters and Second-degree Polynomial in C++, Lecture notes of Computer Programming

Toggle sidebar
bg1
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 ax2 + bx + c,
where a, b, and c are know numbers and a is not equal to zero. Write a C++
pf2

Partial preview of the text

Download Function Parameters and Second-degree Polynomial in C++ and more Lecture notes Computer Programming in PDF only on Docsity!

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.