Website Design United States, Website Design California, Website Designing United States, Website Designing California

Quadratic Equations using Factorisation Method - C++

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

void main() {
cout<<"\tQuadratic Equation Calculator"<<endl<<"\tby Sanchit Karve"<<endl<<endl;

float a,b,c,x,y;

cout<<"\tEquation must be in the form of ax²+bx+c=0"<<endl<<endl;
cout<<"\t\tPlease enter the value of a: ";
cin>>a;

cout<<"\t\tPlease enter the value of b: ";
cin>>b;

cout<<"\t\tPlease 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\n\n\n";
cout.setf(ios::showpos);

float mul=(x*-1)*(y*-1);

cout<<"\t\tx²"<<(y*-1)+(x*-1)<<"x"<<mul<<"=0\n";
cout<<"\t\tx²"<<y*-1<<"x"<<x*-1<<"x"<<(x*-1)*(y*-1)<<"=0\n"; // x²+2x-1x-2=0
cout<<"\t\tx(x"<<y*-1<<")"<<x*-1<<"(x"<<y*-1<<")=0\n"; // x(x+2)-1(x+2)
cout<<"\t\t(x"<<x*-1<<")(x"<<y*-1<<")=0\n\n"; // (x-1) (x+2)=0

cout.unsetf(ios::showpos);

cout<<"\t\tx="<<x<<" & x="<<y<<"\n";
cout<<"\n\n\n\tSanchit Karve\n\tborn2c0de@hotmail.com";

exit(EXIT_SUCCESS);

}

WEB DESIGN INDIA
42 B Malviya Nagar , New Delhi-110017

Skype: manmeetsi
Email: support.webdesignindia@gmail.com
Tel: 91-011-40502005, 9810067295

 















 


© 2008-2009 dotnet4all.com