root - #include #include #include...

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

View Full Document Right Arrow Icon
#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"; } //is c the only non-zero number? cout << "There are no roots" "\n" << "c = " << c << "\n"; } cout << "x = " << -c/b << "\n"; } //if b is zero and c is zero tell user x1 = 0; x2 = 0; cout << "The roots are:" "\n" << "x1 = " << x1 << " , " << "x2 = " << x2 << "\n"; } x1 = 0; x2 = 0; cout << "The values entered result in ax^2= 0; so both roots are 0" "\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

root - #include #include #include...

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