illegal else without matching if

Hi friends How to solve illegal else without matching if
#include <iostream>
#include <conio.h>


using namespace std;

int main()
{
char ch;
cin >> ch;

if (ch == 'r')
cout << "red";
else if (ch == 'b')
cout << "blue";
else if (ch == 'g');
cout << "green";
else
cout << "ERROR";

_getch();
return 0;


}
Last edited on
else if (ch == 'g'); There should not be a semi-colon at the end of that line.
Topic archived. No new replies allowed.