If statements 2

Hey guys can you help me with my code? It's not working. How do I declare If for the scope?

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
72
73
  #include <iostream>
#include <iomanip>

using namespace std;

int main()
{
	double Burgers, Discount, BeforeDiscount, FinalPrice;
	const double BurgerCost = 8;
	
	cout << "# Burgers = ";
	cin >> Burgers;
	
	If (Burgers >= 10 && Burgers <= 19)
	{
		Discount = .10*(Burgers*BurgerCost);
		BeforeDiscount = Burgers*BurgerCost;
		FinalPrice = BeforeDiscount - Discount;
		
		cout << "Discount = $";
		cin >> Discount;
		
		cout << "Final price = $" << BeforeDiscount << " - $" << Discount << " = $" << FinalPrice; 
		
	}
	
	If (Burgers >= 20 && Burgers <= 49)
	{
		Discount = .25*(Burgers*BurgerCost);
		BeforeDiscount = Burgers*BurgerCost;
		FinalPrice = BeforeDiscount - Discount;
		
		cout << "Discount = $";
		cin >> Discount;
		
		cout << "Final price = $" << BeforeDiscount << " - $" << Discount << " = $" << FinalPrice; 
		
	}
	
	If (Burgers >= 50 && Burgers <= 99)
	{
		Discount = .50*(Burgers*BurgerCost);
		BeforeDiscount = Burgers*BurgerCost;
		FinalPrice = BeforeDiscount - Discount;
		
		cout << "Discount = $";
		cin >> Discount;
		
		cout << "Final price = $" << BeforeDiscount << " - $" << Discount << " = $" << FinalPrice; 
		
	}
	
	If (Burgers >= 100)
	{
		Discount = .75*(Burgers*BurgerCost);
		BeforeDiscount = Burgers*BurgerCost;
		FinalPrice = BeforeDiscount - Discount;
		
		cout << "Discount = $";
		cin >> Discount;
		
		cout << "Final price = $" << BeforeDiscount << " - $" << Discount << " = $" << FinalPrice; 
		
	}
		else (Burgers <= 0);
	{
		cout << "Error:\n You have entered an invalid quantity.\n Please enter a valid";
		cout << "number for the next run";
			 
	}
	
	return 0;
}
Last edited on
if vs. If
Topic archived. No new replies allowed.