Errors in my program

it will not run and im not sure why. I have a couple of errors, but I'm not sure why.

Here is my code.

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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//Reads input from user to determine different discounts by number of units sold

#include <iostream> 
#include <string>
using namespace std;

int main() 
{
	//Declaration and Initialization of variables
	int quantity;
	double discount,price = 99.00,totalCost;

	//gets input and checks for valid input
	cout << "How many units were bought?";
	cin >> quantity;


	if (quantity <=1)
	{
		discount = 0;
	}
	else((quantity >= 1 ) && (quantity <10))
	{// error expecting a ;
		discount = 1;
	}
	else((quantity >= 10) && (quantity <20))
	{
		discount = 2;
	}
	else((quantity >= 20) && (quantity <50))
	{
		discount = 3;
	}
	else((quantity >= 50) && (quantity <100))
	{
		discount = 4;
	}
	else((quantity >=100))
	{
		discount = 5;
	}


	switch(discount){

	case 0:
		cout << "Invalid input. Please enter a valid number.";
		break;
	case 1:
		cout << "There is no discount. Your final price is " << quantity*price<< endl;
		cout << "Thank you!" << endl;
		break;
	case 2:
		cout << "Your final price with a 20% discount is " << quantity*price*(.8)<<endl;
		cout << "Thank you!" << endl;
		break;
	case 3:
		cout << "Your final price with a 40% discount is " << quantity*price*(.7)<<endl;
		cout << "Thank you!" << endl;
		break;
	case 4:
		cout << "Your final price with a 60% discount is " << quantity*price*(.6)<<endl;
		cout << "Thank you!" << endl;
		break;
	case 5:
		cout << "Your final price with a 50% discount is " << quantity*price*(.5)<<endl;
		cout << "Thank you!" << endl;
		break; //error here "Not recognizing the being in a break statement
	}

} //error here "Expected a declaration 
need to make those else's else-if's
Topic archived. No new replies allowed.