View Single Post
Old 12-04-2004, 07:25 AM   #3 (permalink)
verdell32
Registered User
 
verdell32's Avatar
 
Join Date: Oct 2004
Posts: 35
verdell32 is on a distinguished road
I need help

This is what I have so far; I pretty sure that if you read my above post you can see what I am doing wrong.

Code:
// Program Documentation //////////////////////////////////////////////////////
//
// Project Name  : QUAD
//
// Source File   : quad.cpp
//
// Programmed By : 
//
// Last Revision : 12/4/2004
//
// Version Number: 0.1
//
// Program Description ////////////////////////////////////////////////////////
//
// This program will calculate the two real roots of a quadratic equation
// of the form.
///////////////////////////////////////////////////////////////////////////////

// Include Files //////////////////////////////////////////////////////////////
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
#include <fstream.h>
#include <math.h>

// Function Prototypes ////////////////////////////////////////////////////////

// Program Mainline ///////////////////////////////////////////////////////////

int main( )
{
   double root1;
   double root2;
   double coefficientA = 3;
   double coefficientB = 2;
   double coefficientC = 4;

   //Enter Information
   cout << "Enter coefficient a:";
   cin >> coefficientA;

   cout << "Enter coefficient b:";
   cin >> coefficientB;

   cout << "Enter coefficient c:";
   cin >> coefficientC;

   //Caculations
   root1 = coefficientB * coefficientB - 4 - coefficientA * coefficientC;
   root2 = coefficientB * coefficientB - 4 - coefficientA * coefficientC;

   if ( 2 >= 0 ) {
      coefficientA = coefficientB;

   }else{
      if ( coeffientA == '0' ) {
         coefficientC = coefficientA * 3;

   }//endif
   }//endif
   cout << "Root 1 is: " << setw(8) << root1 << endl;
   cout << "Root 2 is: " << setw(8) << root2 << endl;

   getch();
   return 0;
}//endmn

Last edited by Valmont; 12-04-2004 at 11:05 PM.
verdell32 is offline   Reply With Quote