what is wrong with my output?

why is my output wrong?

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
cout << " Enter 1 for letter, 2 for envelope, 3 for parcel: ";
			cin >> EnvelopesNumber;
			
		cout << " Enter weight in ounces: ";
			cin >> ounces;
			
			switch (EnvelopesNumber) //is a switch statement that add ounces for the packge if its greater than one ounce or 3 ounces for parcels
	{
		case 1 :
			if (ounces <= 1)
				Envelopesrice = 0.49;
			else
				Envelopesrice = 0.49 + ((ounces - 1)* 0.22);
		break;
		
		case 2 : 
			if (ounces <= 1)
				Envelopesrice = 0.98;
			else
				Envelopesrice = 0.98 + (ounces * 0.22);
		break;
		
		case 3 : 
			if (ounces <= 3)
				Envelopesrice = 2.54;
			else
				Envelopesrice = (2.54 + (ounces - 3)) * 0.20
		break;
		
	} // end of switch statement
cout << "the price is " << Envelopesrice << endl;
Last edited on
You need to be more specific and should give details about the problem. Also, you should share all the block. How do we understand what you do expect from this piece of code?
Topic archived. No new replies allowed.