Click here to Skip to main content
15,916,463 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
#include<iostream>
#include<math.h>
using namespace std;
void main()
{
	int a, b, c, d;
	double  x, x0, x1, x2;
	cout << "nhap a,b,c";
	cin >> a >> b >> c;
	if (a == 0)
	{
		if (b == 0)
			cout << " a va b khong dong thoi bang khong moi ban nhap lai" << endl;
		else
			x0 = -c / b;
		cout << x0 << endl;
	else
	{


		d = b*b - 4 * a*c;
		if (d < 0)
		{
			cout << "phuong trinh vo nghiem" << endl;
		}
		if (d == 0)
		{
			x = -b / (2 * a);
			cout << "nghiem kep cua phuong tring" << x << endl;
		}
		if (d > 0)
		{

			x1 = (-b + sqrt(d)) / (2 * a);
			x2 = (-b - sqrt(d)) / (2 * a);
			cout << "nghiem 1 cua phuong tring la" << x1 << endl;
			cout << "nghiem 2 cua phuong tring la" << x2 << endl;
		}
	}


	system("pause");

	}
}


What I have tried:

im just learned basic code
can u show me where i is wrong?
Posted
Updated 24-Sep-17 21:10pm
v2
Comments
Dave Kreskowiak 24-Sep-17 21:25pm    
Did you want to describe the problem or should everyone just guess at what's wrong?

1 solution

 
Share this answer
 
Comments
CPallini 25-Sep-17 3:11am    
5.
Patrice T 25-Sep-17 3:13am    
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900