why am i geting this error

For Some reason im getting the error
error C2181: illegal else without matching if
with this code, can someone tell me why

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
#include <iostream>
#include <string>
using namespace std;
int main()
{
	for(bool loop(true);loop==true;){
		cout<<"Enter The Conversion Type (Type Help For A List): ";
		string Conversion_Type;
		getline(cin,Conversion_Type);
		for(int i=0;i<Conversion_Type.length();i++){
			Conversion_Type[i]=tolower(Conversion_Type[i]);}
		if(Conversion_Type=="exit"){
			return 0;}
		if(Conversion_Type=="help"){
			cout<<"\n Conversion Types \n";
			cout<<" ---------------- \n";
			cout<<" Help = Brings Up The Help Menu \n";
			cout<<" Temperature = Converts Fahrenheit,Celsius, And Kelvin To One Another\n";
			cout<<" Currency = Converts Currencies \n";
			cout<<" Hash = Converts And Decrypts MD5,SHA-0,SHA-1,and SHA-2 Hashes \n";
			cout<<" Exit = Exits The Program \n\n";}
		if(Conversion_Type=="temperature"){
			cout<<"Do You Want To Convert A Temperature To Fahrenheit,Celsius, or Kelvin: ";
			string Convert_To_Unit;
			getline(cin,Convert_To_Unit);
			for(int i=0;i<Convert_To_Unit.length();i++){
				Convert_To_Unit[i]=tolower(Convert_To_Unit[i]);}
			if(Convert_To_Unit=="fahrenheit"||Convert_To_Unit=="celsius"||Convert_To_Unit=="kelvin"){
				cout<<"Is The Temperature You Want To Convert Fahrenheit,Celsius, or Kelvin: ";
				string Base_Unit;
				getline(cin,Base_Unit);
				for(int i=0;i<Base_Unit.length();i++){
					Base_Unit[i]=tolower(Base_Unit[i]);}
				if(Base_Unit=="fahrenheit"||Base_Unit=="celsius"||Base_Unit=="kelvin"){
					cout<<"Enter The Temperature: ";
					string Temperature;
					getline(cin,Temperature);
					bool Number(true);
					for(int i=0;i<Temperature.length();i++){
						if(isdigit(Temperature[i])){}
						else{
							Number=false;}}
					if(Number==true){
						cout<<"It's a number \n";}
					else{
						cout<<"It's not a number \n";}
				else{
					cout<<Base_Unit<<" Is An Invalid Option \n";}}
			else{
				cout<<Convert_To_Unit<<" Is An Invalid Option \n";}}}}}
and just so everyone knows this program is FAR from complete
just so everyone knows the error is on line 48
You have your brackets mixed up. Most people use a coding style that matches the brackets up so that mistakes like this are harder to make and easy to spot:

Columnating brackets:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if(a)
{
    if(b)
    {
        // ...
    }
    else
    {
        // ...
    }
}
else
{
    // ...
}


Matching close bracket with the initial if()
1
2
3
4
5
6
7
8
9
10
if(a)
{
    if(b) {
        // ...
    }  else  {
        // ...
    }
} else {
    // ...
}


Or some such scheme that makes keeping track of the indentation level trivial rather than rocket science ;o)
well can someone tell me exactly which brackets need to be adjusted because i can't seem to figure that out
Everyone has the same problem as you. The code is hard to read.
well if someone figures it out that would be great, im still trying to figure it out
ok i finally figured it out
Topic archived. No new replies allowed.