Have no idea what to do

GoPredsGo (13)
This is a homework assignment and I am almost done but I get one syntax error, 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include <iostream>
#include <cctype>
#include <cmath>
#include <string>
#include <iomanip>
 

using namespace std;

 
int main()
{

    enum Planet {MERCURY, VENUS, EARTH, MOON, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO};
    string planet;
    string badData = "**Invalid Planet**\n";
    Planet inPlanet;
    double weight;
    double factor;
    
	// Output Variable
	double newWeight;
 

	do
{
    cout << "Please enter a planet: ";
    cin >>planet;
	
    switch(toupper(planet[0]))
    {
        case 'M' : if(toupper(planet[1]) == 'E')
                   {
                       inPlanet = MERCURY;
                       planet = "MERCURY";   // will correct any spelling mistakes so long as the first two letters are ME
                   }

                   else if(toupper(planet[1]) == 'A')
                   {
                       inPlanet = MARS;
                       planet = "MARS";  // will correct any spelling mistakes so long as the first two letters are MA
                   }
                   else if(toupper(planet[1]) == 'O')
                   {
                       inPlanet = MOON;
                       planet = "MOON";  // etc... you get the idea
                   }
                   else
                   {
                        cout <<badData;    // will output badData if the entry is invalid
                        main();          // will start from the beginning
                   }
                   break;


        case 'V' : inPlanet = VENUS;
                   planet = "VENUS";
                   break;
        case 'E' : inPlanet = EARTH;
                   planet = "EARTH";
                   break;
        case 'J' : inPlanet = JUPITER;
                   planet = "JUPITER";
                   break;
        case 'S' : inPlanet = SATURN;
                   planet = "SATURN";
                   break;
        case 'U' : inPlanet = URANUS;
                   planet = "URANUS";
                   break;
        case 'N' : inPlanet = NEPTUNE;
                   planet = "NEPTUNE";
                   break;
        case 'P' : inPlanet = PLUTO;
                   planet = "PLUTO";
                   break;
        default :  cout <<badData <<endl;                                       
                   break;
  
	}
	
	cout << "Please enter your weight in pounds: ";
    cin >> weight;
	
	while (weight)
    if(inPlanet == MERCURY)
        factor = 0.4155;
    else if(inPlanet == VENUS)
        factor = 0.8975;
    else if(inPlanet == EARTH)
        factor = 1.0;
    else if(inPlanet == MOON)
        factor = 0.166;
    else if(inPlanet == MARS)
        factor = 0.3507;
    else if(inPlanet == JUPITER)
        factor = 2.5374;
    else if(inPlanet == SATURN)
        factor = 1.0677;
    else if(inPlanet == URANUS)
        factor = 0.8947;
    else if(inPlanet == NEPTUNE)
        factor = 1.1794;
    else if(inPlanet == PLUTO)
        factor = 0.0899;
}
    // Output the results

	newWeight = factor * wieght;

	

    cout << "You selected " << planet << " as your planet. " << endl;
    cout << "You entered " << weight << " as your weight. " << endl;
    cout << fixed << setprecision(2) << "Your weight on " << planet << " is " << newWeight << "lbs" << endl;
 
	cin.get();
	cin.get();
	return 0;
}


And here is my error:
error C2061: syntax error : identifier 'newWeight'

I have gone back to assignments like this one and I never got that error, could someone please point me in the right direction, thanks
Anders Ekdahl (6)
am I missing something or have you missed something, what type is newWieght?

int, double?
Chervil (812)
Don't try to call main(); from within main().

Use the normal control structures such as the while loop, or an if statement to achieve the processing you want.
Registered users can post here. Sign in or register to post.