Control Structures not working

Im building a quadratic formula solver. I havent yet put in the actual formla to get the solutions, but ive done the discriminant. Everything works in the build, but my if and else commands arent having any effect. :(, help please!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

#include "stdafx.h"
#include "math.h"
#include "iostream"
#include <cstdlib>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	
	cout << "Enter the coeffecient of x^2: " << endl;
		int a;
	cin >> a;
	cout << "Enter the coeffecient of x: " << endl;
		int b;
	cin >> b;
	cout << "Enter the final coeffecient: " << endl;
		int c;
	cin >> c;
			double dis = (b*b)-(4*a*c);
	cout << "Your discriminant is " << dis << "." << endl;
		double x = (-b)/(2*a);
	
	if (dis < 0)
	{
		cout << "There are no real solutions to this equation." << endl;
	}
	if (dis = 0)
	{
		cout << "The solution to the equation is " << x << "." << endl;
	}
	else
	{
		cout << "Your solutions are: " << endl;
	}
	return 0;
}

Line 29 should be else if (dis == 0) because:
1) All your conditions are connected, you want the else to run if both the previous conditions are false.
2) The = operator is generally used for assignment, == is for comparison.
Thanks so much!
Topic archived. No new replies allowed.