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

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

2012/2013

Uploaded on 04/27/2013

kid
kid 🇮🇳

4.3

(18)

110 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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.