COS120_hw3 - 26da7250e69ea9b4563991b8d71f9d691aec1f27.doc...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
26da7250e69ea9b4563991b8d71f9d691aec1f27.doc Page 1 of 3 COS120 Software Development Using C++ Student: Homework Nmr 03 (Decisions) Tasks: Write a program to compute roots (solutions) of a linear equation bx + c = 0 and to compute roots (solutions) of a quadratic equation ax2 + bx + c = 0 Write a program to test user defined function qualityPoints that checks a student’s average and returns 4 if a student’s average is 90-100, 3 if the average is 80-89, 2 if the average is 70-79, 1 if the average is 60-69, and 0 if the average is below 60. Task 1 #include <iostream> #include <math.h> #include <cctype> using namespace std; int main(void) { float a, b, c, x1, x2, x3, x4; //we declare the variables as float because we //are dealing with square roots cout << "Enter the coefficients a , b , c :\n"; cin >> a >> b >> c; //are all the coefficients 0? if so both roots are 0 x1 = 0; x2 = 0; cout << "The roots are:" "\n" << "x1 = " << x1 << " , " << "x2 = " << x2 << "\n";
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/24/2010 for the course COS 120 taught by Professor Bonev during the Fall '08 term at American University in Bulgaria.

Page1 / 3

COS120_hw3 - 26da7250e69ea9b4563991b8d71f9d691aec1f27.doc...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online