Cant figure out

It says "illegal else without matching if". How do i fix this.

More info: Project is on how much kilowatts a person uses in a month and how much it will cost.

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
41
42
43
44
45
 #include <iostream>
using namespace std;

int main()
{

	int kilowatts;
	double cost;

	
	
	
	cout << "Enter the number of kilowatts used "
		<< "during the month" << endl;
	
	
	if (kilowatts <= 1000); 
	{
		cost = 12.87 + (kilowatts * .10);
		cout<< cost;
	}


	
	else if
		((kilowatts > 1000)&& (kilowatts <= 2000) )
	{
		cost = cost + (kilowatts * .08);
		cout<< cost;
	}
	
	

	else  
	{
		cost = cost + (kilowatts * .05);
		cout<< cost;
	}




	system("pause");
	return 0;
}
remove semi-colon on line 17.
edit: and then actually read some value into your 'kilowatts' and 'cost' variables.
Last edited on
Topic archived. No new replies allowed.