123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Solving Quadratic Equations using Factorisation:( Shows SOLUTION )

--------------------------------------------------------------------------------

Description : Prints the Solution of a Quadratic Equation on Screen as you
would solve it using Factorisation.
Each and every step is shown as it is solved on paper.


#include <stdlib.h>
#include <iostream.h>
#include <math.h>
#include <conio.h>

void main()
{
cout<<" Quadratic Equation Calculator"<<endl<<" by Sanchit
Karve"<<endl<<endl;
float a,b,c,x,y;
cout<<" Equation must be in the form of ax²+bx+c=0"<<endl<<endl;
cout<<" Please enter the value of a: ";
cin>>a;
cout<<" Please enter the value of b: ";
cin>>b;
cout<<" Please enter the value of c: ";
cin>>c;
x=((-b+sqrt((b*b)-(4.0*a*c)))/(2.0*a));
y=((-b-sqrt((b*b)-(4*a*c)))/(2*a));


clrscr();
cout<<"HERE IS THE SOLUTION USING FACTORISATION

<BR>;
cout.setf(ios::showpos);
float mul=(x*-1)*(y*-1);
cout<<" x²"<<(y*-1)+(x*-1)<<"x"<<mul<<"=0<BR>;
cout<<" x²"<<y*-1<<"x"<<x*-1<<"x"<<(x*-1)*(y*-1)<<"=0<BR>; //
x²+2x-1x-2=0
cout<<" x(x"<<y*-1<<")"<<x*-1<<"(x"<<y*-1<<")=0<BR>; // x(x+2)-1(x+2)
cout<<" (x"<<x*-1<<")(x"<<y*-1<<")=0
<BR>; // (x-1) (x+2)=0
cout.unsetf(ios::showpos);
cout<<" x="<<x<<" & x="<<y<<"<BR>;
cout<<"


Sanchit Karve
born2c0de@hotmail.com";
exit(EXIT_SUCCESS);
}
 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG