Starting to get annoyed with this

Im not sure whats wrong with my code but I've tweaked it like 20 times. Can anybody help me? I feel like I'm missing something obvious.
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
  //Shipping Widgets
//David Karayof
//Oct. 21, 2008

#include<iostream>
using namespace std;

int main()
{
//Declare Variables
 double Widgets=0;
 double totwidg = 0.0, totfoam = 0.0, foam, Ssmall = 0.0, Smed= 0.0, Slg = 0.0;
 const double Small = 4.0, Medium = 6.0, Large = 10.0;
  
  cout << "Shipping Widgets\n\n";
  cout << "We can ship up to 10 widgets in boxes of three sizes:\n";
  cout << "A small box holds " << Small << " widgets\n";
  cout << "A medium box holds " << Medium << " widgets\n";
  cout << "A large box holds " << Large << " widgets\n";
  cout << "Unused space in the box is filled with foam blocks which\n are ";
  cout << "the same size as a widget\n";

  //Input data
  cout << "\n\nInput the number of widgets to ship: ";
  cin >> Widgets;
 
  while(Widgets <=10.0 && Widgets > 0.0);
  {	  
	  if(Widgets <= 4.0) 
		{ 
		cout << "A small box was used to ship" << Widgets << "units";
		foam = 4.0 - Widgets;
		totfoam += foam;
		Ssmall = Ssmall + 1;
		totwidg += Widgets;
        }
     else if(Widgets <= 6.0) 
        { 
        cout << "A medium box was used to ship" << Widgets << "units";
        foam = 6.0 - Widgets;
        totfoam += foam;
        Smed = Smed + 1;
        totwidg += Widgets;
	    }
      else if(Widgets <= 10.0) 
       { 
       cout << "A large box was used to ship" << Widgets << "units";
       foam = 10.0 - Widgets;
       totfoam += foam; 
       Slg = Slg + 1;
       totwidg += Widgets;
       }
	 cout << "\n\nInput the number of widgets to ship: ";
	 cin >> Widgets;
}

    //Output current status
    cout << "\nA total of " << totwidg << " widgets were shipped,";
    cout << " using " << Ssmall << " small boxes, " << Smed<< " medium";
	cout << " boxes, " << Slg << " large boxes, and " <<totfoam << " foam";
	cout << " packing blocks.\n\n";
	
	return 0;
  }
it should output:

Shipping Widgets.

We can ship up to 10 widgets in boxes of three sizes:

A small box holds 4 widgets.
A medium box holds 6 and a large box 10.

Unused space in the box is filled with foam blocks
which are the same size as a widget.

Input the number of Widgets to ship: 4
A small box was used to ship 4 units.

Input the number of Widgets to ship: 8
A large box was used to ship 8 units.

Input the number of Widgets to ship: 5
A medium box was used to ship 5 units.

Input the number of Widgets to ship: 10
A large box was used to ship 10 units.

Input the number of Widgets to ship: 1
A small box was used to ship 1 units.

Input the number of Widgets to ship: 0


A total of 28 widgets were shipped, using
2 small boxes, 1 medium boxes, 2 large boxes,
and 6 foam packing blocks.

Press any key to continue . . .
what does it output?
@dkarayof

Remove the semi-colon at the end of this line while(Widgets <=10.0 && Widgets > 0.0);
and your program will work.
NOOOO, I wanted to say that! xD
@Hedgehog Ninja

Sorry 'bout that ;)

I guess the saying is true, then.
'Great minds think alike'. You can catch the next one...
Topic archived. No new replies allowed.