0% found this document useful (0 votes)
45 views

Classwork Applications For C++ Operators & Intrinsic Functions

The document contains 9 questions about C++ operators and intrinsic functions. The questions cover topics like correcting code to calculate a function, writing code to evaluate algebraic formulas, finding trigonometric functions like cosine and sine at points on a unit circle, calculating the area of a right triangle given side lengths, evaluating arithmetic expressions using operators like floor, ceil, modulus, and intrinsic functions like sqrt, and writing programs to calculate given functions and output data in a table format.

Uploaded by

Nicholas Murray
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Classwork Applications For C++ Operators & Intrinsic Functions

The document contains 9 questions about C++ operators and intrinsic functions. The questions cover topics like correcting code to calculate a function, writing code to evaluate algebraic formulas, finding trigonometric functions like cosine and sine at points on a unit circle, calculating the area of a right triangle given side lengths, evaluating arithmetic expressions using operators like floor, ceil, modulus, and intrinsic functions like sqrt, and writing programs to calculate given functions and output data in a table format.

Uploaded by

Nicholas Murray
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CLASSWORK APPLICATIONS FOR C++ OPERATORS & INTRINSIC FUNCTIONS Q1.

Correct the program given below that calculates the function for arbitrary values of x.

#include <iostream> using namespace std; int main() { double x,fx; cout<<"input x\n"; cin>>x; fx=x/3-pow(x,3)/(x-3/2); cout<<"fx ="<<fx system ("pause"); }

Sample Output
input x 2 fx =-14.6667

Q2. Write C++ statements to evaluate the following algebraic formulae: a) z d) z


a b cd

b) z a

b cd

c) z

a b d c

a b d c ef

Q3. Write a program to find the Cosines and Sines of angles at points A, B,C and D at the unit circle.
B (0,1) C(-1,0) A (1,0)

D (0,-1)

Q4. Write a program to read the lengths of the two sides of a right angle triangle and calculate and display the area of the triangle (one-half the product of sides) and the length of the hypotenuse (square root of the sum of the squares of the sides).

Q5. Find the result of the following arithmetic operation; double( floor(5.2) / ceil(-2.7) ) + 5%2

Q6. Find the result of following operation. abs(-2.3)/2+1.3*sqrt(4.)/double(5/2)

Q7. Find the result of each line int the following program section: double x=10.0, y=0.01, z=0.5 ; int i=10, j=25, k=3 ; cout << ceil(j/x)+floor(x+j/2) ; cout << z * x / 10 + k ; cout << z * k + z * j + z * i ; cout << i * y - k / x + j ; Q8. Write a program to calculate the following function:

Where e is well known constant.

Q9. Write a program to obtain the following table for your friends:

Name Ali

Surname Can

City stanbul

Phone 0 5?? ???????

You might also like