# Thread: Mujhe C++ ki help chahiye...

1. Senior Member+
Last Online
27th February 2015 @ 11:47 AM
Join Date
13 Jun 2011
Location
Peshawar
Age
26
Gender
Male
Posts
138
32
Credits
0
Thanked
3

## Mujhe C++ ki help chahiye...

Assalam o alaikum experts... mujhe C++ ki help chahiye.. pehle to visual studios 10 ultimate full chahiye jo k meri university mai use ho raha hai.. second mje koi ye btaay k mai vs mai quadratic equation ko solve kese krun??? -b(sq) +- Sqrt b(sq) - 4ac / 2a
ye meri assignment hai mene simple calculator to bna lia hai lakin ye mujhe samjh nhi arahi to plzz koi help krde..

2. Junior Member
Last Online
15th November 2017 @ 04:35 PM
Join Date
04 Nov 2009
Age
32
Posts
5
0
Credits
511
Thanked
0
VS ki DVD khareed lo ya university may kisi dost say b li jasakti hay.

Quadratic Equation C++ ka code ye hay.

int a,b,c,discriminant;
float r1,r2;
cout<<"enter the values of a,b,c";
cin>>a>>b>>c;
discriminant=((b*b)-4*a*c);
if(discriminant>0)
{
r1=(-1*b+sqrt(discriminant))/(2*a);
r2=(-1*b-sqrt(discriminant))/(2*a);
}
else if(discriminant==0)
{
r1=r2=(-1*b)/(2*a);
}
else
{
discriminant=-1*discriminant;
cout<<"r1="<<"("<<(-1*b)<<"+ i"<<sqrt(discriminant)<<")/"<<2*a;
cout<<"r1="<<"("<<(-1*b)<<"+ i"<<sqrt(discriminant)<<")/"<<2*a;
exit(0);
}
cout<<"r1="<<r1<<"\n";
cout<<"r2="<<r2<<"\n";
return 0;

3. Senior Member+
Last Online
27th February 2015 @ 11:47 AM
Join Date
13 Jun 2011
Location
Peshawar
Age
26
Gender
Male
Posts
138
32
Credits
0
Thanked
3
szacpp said:
VS ki DVD khareed lo ya university may kisi dost say b li jasakti hay.

Quadratic Equation C++ ka code ye hay.

int a,b,c,discriminant;
float r1,r2;
cout<<"enter the values of a,b,c";
cin>>a>>b>>c;
discriminant=((b*b)-4*a*c);
if(discriminant>0)
{
r1=(-1*b+sqrt(discriminant))/(2*a);
r2=(-1*b-sqrt(discriminant))/(2*a);
}
else if(discriminant==0)
{
r1=r2=(-1*b)/(2*a);
}
else
{
discriminant=-1*discriminant;
cout<<"r1="<<"("<<(-1*b)<<"+ i"<<sqrt(discriminant)<<")/"<<2*a;
cout<<"r1="<<"("<<(-1*b)<<"+ i"<<sqrt(discriminant)<<")/"<<2*a;
exit(0);
}
cout<<"r1="<<r1<<"\n";
cout<<"r2="<<r2<<"\n";
return 0;
yar ap boht advanced kr rhay ho.. hmain filhal cout, cin, int, float, else, if else parhaya gaya hai.. boht basics coz 1st semester hai.. isliye us tareeqay se batain...