1. Kindly help!!!

hi this is Fatima..!! i have started C++ programming few days back..!!
i am given an assignment fer homewrk.In the prob i have to take the sqr root but i dun knw how to take square root.
the code is

Code:
```#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int roots1,roots,a,b,c;
cout<<"Enter value of a=";
cin>>a;
cout<<"Enter value of b=";
cin>>b;
cout<<"Enter value of c=";
cin>>c;

if  (b*b- 4*a*c==0)
{
cout<<"Roots are single,equal";
}
else if (b*b-4*a*c>0)
{
cout<<"Equation has two real roots";
}
else if (b*b-4*a*c<0)
{
cout<<"Equation has two complex roots";
}
else if (b*b-4*a*c>=0)
{
roots=-b+sqrt(b*b-4*a*c)/2*a;
roots1=-b-sqrt(b*b-4*a*c)/2*a;
cout<<"The roots are"<<roots<<roots1<<endl;
}
getch();
}```
in the last part if b^2-4ac is greater than and equal to zero then i have to take square root of it..and display the roots but i dun knw how to..!!

2. You seem to use an aincent compiler.
When I use the new headers and include the math header it compiles fine.
Code:
```// #include<iostream.h>
#include<cmath>  // for std::sqrt

using namespace std;  // reqired with the modern headers

// void main() {
int main() {  // Main returns int

int roots1,roots,a,b,c;
cout<<"Enter value of a=";
cin>>a;
cout<<"Enter value of b=";
cin>>b;
cout<<"Enter value of c=";
cin>>c;

if  (b*b- 4*a*c==0)
{
cout<<"Roots are single,equal";
}
else if (b*b-4*a*c>0)
{
cout<<"Equation has two real roots";
}
else if (b*b-4*a*c<0)
{
cout<<"Equation has two complex roots";
}
else if (b*b-4*a*c>=0)
{
roots=-b+sqrt(b*b-4*a*c)/2*a;
roots1=-b-sqrt(b*b-4*a*c)/2*a;
cout<<"The roots are"<<roots<<roots1<<endl;
}
}```
Kurt

3. thnx...then how to upgrade the compiler..???

4. Originally Posted by Fatima Rizwan
thnx...then how to upgrade the compiler..???
What are you using ?
Kurt

`#include <math.h>`