Can somebody please review my code for errors

WARNING!! this code is hefty so i cut out cases 2-5 to fit it in before i cut the cases out it was 20,000 character and its still not done yet. It is the same code as other cases for the switch(from) just diffrernt conversion formulas.And it is ackward because of this scrren. A thing that will help is to copy to compiler.(i used dev)
ok. thats the "warning". Can u please review the code i mean for basis of working. Especially the goto's because i just implemented them after i forgot to put defaults. I did sorta comment so peeps can know what i plan. AND before andbody saya so. i will get rid of this usless code by putting them all into seperate function.
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
121
122
123
124
#include<iostream>//headers	
#include<cstdlib>
using namespace std;//for cin,cout,endl..etc.

int main(){//man function
   
    long double answer;//initializing variable for numbers
    long double number;
    int from;
    int to;
    char loop='y';// loop var
    int loop_error;
  do 
  {
         system("CLS");
         menu:
         cout << "Welcome to Measurment System Converter" << endl; 
         cout << "Convert from the following:" << endl;
         cout << "inches[1] centimeters[2] millimeters[3]" << endl;//shows option
         cout << "feet[4] yards[5] kilometers[6] miles[7]" <<endl;
         cout << "Enter the corresponding number: "; 
         cin >> from;//ask which option
         system("CLS");
         switch(from) //switch case for each number of choices earlier
		 {
                   case 1:
                        redo:
                        cout << "Convert to the following:" << endl;
                        cout << "centimeters[1] millimeters[2]" << endl;
                        cout << "feet[3] yards[4] kilometers[5] miles[6]" <<endl;//what to convert to
                        cout << "Enter the corresponding number: ";
                        cin >> to;// asked what convert to
						
						switch(to)// switch case for what unit to convert too(last switch case) 
						{
								case 1 :
									cout << "Type in an amount of inches to convert to centimeters: ";                                                
									cin >> number;//ask amount of inches to convert
									answer = number * 2.54;//conversion eqaution
									cout << endl << number << " converted to centimeters equals: " << answer;//answer
									cout << endl << "Would you like to try again? [y/n]: ";
									cin >> loop;//try again loop
								break;
								case 2 :
									cout << "Type in an amount of inches to convert to millimeters: ";
									cin >> number;// ask amount of mm to convert
									answer = number * 25.4;//eqaution
									cout << endl << number << " converted to millimeters equals: " << answer;//answer
									cout << endl << "Would you like to try again? [y/n]: ";//try again loop
									cin >> loop;
								break;
								case 3 :
									cout << "Type in an amount of inches to convert to feet: ";
									cin >> number;// ask amount of mm to convert
									answer = number / 12;//eqaution
									cout << endl << number << " converted to feet equals: " << answer;//answer
									cout << endl << "Would you like to try again? [y/n]: ";//try again loop
									cin >> loop;//comments after this are redundant
								break;
								case 4 :
									cout << "Type in an amount of inches to convert to yards: ";
									cin >> number;
									answer = number / 36;
									cout << endl << number << " converted to yards equals: " << answer;
									cout << endl << "Would you like to try again? [y/n]: ";
									cin >> loop;
								break; 
								case 5 :
									cout << "Type in an amount of inches to convert to kilometers: ";
									cin >> number;
									answer = number * 0.0254 ;
									cout << endl << number << " converted to kilometers equals: " << answer;
									cout << endl << "Would you like to try again? [y/n]: ";
									cin >> loop;
								break;
								case 6 :
									cout << "Type in an amount of inches to convert to miles: ";
									cin >> number;
									answer = number * 0.000016 ;
									cout << endl << number << " converted to miles equals: " << answer;
									cout << endl << "Would you like to try again? [y/n]: ";
									cin >> loop;
								break;
								default://if anything except a number is typed
                                    cout << "I am sorry but your choice is invalid" << endl;
                                    cout << "If you would like to revise your choice press [1]" << endl;
                                    cout << "If you would like to quit press [2]"<<endl;
                                    cout << "Enter Here: ";
                                    cin  << loop_error;//chose 1 or 2
                                         switch(loop_error)
                                              {
                                               case 1: //revise choice goes back to last choice
                                                    goto redo;
                                               break;
                                               case 2://quit by returning 0(terminate program)
                                                    return -1;
                                               break;
                                               default:/* if they put in something stupid again, screw them(or send
                                               them back to the first menu*/
                                                    cout << "You will be redirected to the main menu..."<< endl;
                                                    system("PAUSE")
                                                    goto menu;
                                               break;
                                               }     //close default switch      
                                    
								break;
								}//closes switch(to)
					break;
                                           
                    case 6:// didnt do yet following are the same as before just diffrernt formulas
                   
                    break;
                   
                    case 7:
                        
                    break;
                        
                   default :
                           
                   break;
				   }// closing bracket for switch(from)
         } while (loop == 'y' || loop == 'Y');// while loop for the try again option(and closing bracket for do)
          return 0;// return 0 to end program
          } //closing for int main 

ok thats it. once again i apoligize for how the code looks because of the size of he windwo.
Topic archived. No new replies allowed.