Dev c++ help

I need to know the problem ( Im new to C++ ) theres an error on starting at the else if

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
  #include<iostream>
using namespace std;
int main()
{
    double f,ccel,ffar,c;
    f=0;
    c=0;
    char cel_or_far[30];
    cout<<"Please specify if you want 'farenhiet' or 'celsius' : ";
    cin>>cel_or_far;
    if ( (stricmp ("Farenheit",cel_or_far)==0) || (stricmp ("farenheit",cel_or_far) ==0) );
    {
         cout<<"Please enter the value for Farenheit :  ";
         cin>>f;
         ccel=(f-32)/1.8;
         cout<<"Farenheit "<<f<<" is "<<ccel<<" in celsius "<<"\n";
    }
    else if( (stricmp ("Celsius",cel_or_far)==0) || (stricmp ("clesius",cel_or_far) ==0) );
    {
         cout<<"Please enter the value for Celsius :  ";
         cin>>c;
         ffar=(c*1.8)+32;
         cout<<"Celsius "<<c<<" is "<<ffar<< "in celsius : "<<endl;
    }
    else
    {
        cout<<"You typed in "<<cel_or_far<<"\n\n";
    }
    system ("pause");
    return 0;
}


Thanks in advance and an explaination would be helpful. ^^;
if (/*...*/ ) ; //←This is the problem
Your code structure
1
2
3
4
5
6
7
if(/*...*/)
    ; //THEN statement is closed here. else should be next statement

{/*...*/} //Not an else statement, but block statement, 
//by language rules that means if statement does not have else and is closed here

else //...// Stray else which does not belong to any if, error 


Solution: remove semicolon after if:
1
2
3
4
5
6
7
8
if (cond) //no semicolon
{
    statements
} 
else
{
    statements
}
ah ><; ty >.>; i shoudl really really really triple check ...
Topic archived. No new replies allowed.