CSCE106 Lab Session 5
CSCE106 Lab Session 5
Objectives:
Problems:
Write a C++ program or each of the following problems:
1. Draw a Flow chart and write a program in C++ that reads a positive integer number to notify the
user with a message whether the integer number Even or Odd.
2. Draw a Flow chart and write a program in C++ that reads a real number to notify the user with
a message whether the real number Positive, Zero, or Negative.
3. Draw a Flow chart and write a C++ program to solve the quadratic equation ax2 + bx + c = 0
where coefficient a is not equal to 0. The equation has two real roots if its discriminator d = b2
– 4ac is greater or equal to zero. The program gets the three coefficients a, b, and c, computes
and displays the two real roots (if any). It first gets and tests a value for the coefficient a. if this
value is zero, the program displays an error message and terminates, otherwise it proceeds to
get a value for the coefficient b and a value for the coefficient c. Next it computes and tests the
discriminator d = b2 – 4ac. If the discriminator d is negative, the program displays an error
message “No Real Roots!!” and terminates, otherwise it proceeds to compute and display the two
real roots R1 and R2 according to the following formulas:
Instructions: