#include<stdio.h>
#include<iostream>
#include<string>
#include<conio.h>
#include<fstream>

using namespace std;

class TESTnonteaching
{
private:
		string oname;
		string osir_name;
		int oid;
		
public:
	int count3;
		void TESTadd();
		void TESTsearching();
		//void editing();
		void TESTdisplay3();
		void TESTsetcount3()
		{	count3=0 ;
		}
};

//ADDING STAFF//

void TESTnonteaching::TESTadd()
{
if(count3>=3)
{cout<<"NO SPACE LEFT"; return;
}
 cout<<"ENTER YOUR NAME \n";
 cout<<"Terminate with '$' "<<endl;
 getline(cin,oname,'$');
 /*
 //IF THE USER ENTRS AN INTEGER
 {
    if( oname == (int intValue) ) 
    goto k3;
 }//if loop ends
 k3:
 {
 string IntToString(int intValue) { 
  char *myBuff; 
  string strValue; 
  // Create a new char array 
  myBuff = new char[100]; 
  // Set it to empty 
  memset(myBuff,'\0',100);
//............................................................/  
/*memset (void *source, int value, size_t num);.
//Know that source is a pointer to the block of memory to fill and value is 
//the character to be set. This byte value is internally converted to an unsigned char. Num is the number of be set. Memset will set the first num bytes of the memory pointed to by source to the specified value and return source.
//Understand that the C++ memset function is kept in the cstring library.
// You may need to include the string.h header file to use this function.
*/
//................................................................/

/*
 Convert to string 
  itoa(intValue,myBuff,10); 
  //Copy the buffer into the string object 
  strRetVal = myBuff; 
   // Delete the buffer:- 
    delete[] myBuff; 

  return(strValue); 
 }
*/
cout<<"ENTER YOUR SIR NAME \n";
getline(cin,osir_name,'$');
/*//IF THE USER ENTERS A NON-ALPHABETICAL VALUE
{ 
   int intValue;
   if( osir_name[count3] == intValue ) 
   goto k3;
} */

G1:
 cout<<"ENTER YOUR ID NUMBER\n";
 cin>>oid;
{
if (( oid =='`'|| oid ==';'|| oid ==','|| oid =='<'|| oid =='>'|| oid =='.'|| oid =='/'|| oid =='?'))
           cout<<"ERROR! YOU JUST TYPED A NON-INTEGER VALUE."<<endl;
		   cout<<"ERROR! YOU JUST TYPED A NON-INTEGER VALUE!Enter an integer please"<<endl;
else if((oid == '%'||oid =='^'||oid=='*'||oid =='$'||oid =='#'||oid =='@'||oid =='!'||oid =='~'))
	 cout<<"......"<<endl; 
else if(oid<1&&oid>100)
cout<<"ENTER BETWEEN 1 AND 100"<<endl;
cout<<"Enter"<<endl;
}


int arr[3]={26,36,46}; 
for(int i=0;i<count3;i++)
{ 
	 if(oid==arr[i])
    cout<<"ID NUMBER ALREADY EXISTS.";
     goto G1;
 }
++count3;
}

/*
//SEARCH STAFF MEMBERS//
void TESTnonteaching::TESTsearching()
{ 
		if(count3<1)
		{	cout<<"NO RECORDS AVAILABLE"; return;
		}
			int temp;
			char ch;
			int check=0;
		cout<<"ENTER ID NUMBER THAT YOU NEED TO SEARCH:\n";
		cin>>temp;
		for(int i=0;i<count3;i++)
		   {if(temp==oid[i])
		      {check=1;
		       cout<<"NAME IS \n"<<oname[i];
			   cout<<"SIR NAME IS \n"<<osir_name[i];
			   cout<<"ID NUMBER IS \n"<<oid[i];
			   cout<<"RECORD SEARCHED SUCCESSFULLY\n";
		      }
		   }
		if(check==1)
		{cout<<"RECORD SEARCHED SUCCESSFULLY"<<endl;}
		else
		{cout<<"INVALID ID NUMBER"<<endl;
        return;}
	

}
//DISPLAY RECORD OF WHOLE STAFF//
void TESTnonteaching::TESTdisplay3()
{
  for(int i=0;i<count3;i++)
  {cout<<"NAME \n"<<oname[i];
   cout<<"SIR NAME \n"<<osir_name[i];
   cout<<"ID NUMBER \n"<<oid[i];
}

*/
int main()
{
    TESTnonteaching TNT;
    TNT.TESTsetcount3();	
	TNT.TESTadd();
    //TNT.TESTsearching();
	//TNT.editing();
	//TNT.TESTdisplay3();
		system("pause");
		return 0;
}

1.cpp(88) : error C2181: illegal else without matching if

I just cant seem to solve this error.Why is it coming?
To solve this problem,I used three if loops separately so that each if loop checks a different condition but when i put the three if statements separately,the output prints all the three if cout statements without checking the conditions.... i.e:

{
if (( oid =='`'|| oid ==';'|| oid ==','|| oid =='<'|| oid =='>'|| oid =='.'|| oid =='/'|| oid =='?'))
           cout<<"ERROR! YOU JUST TYPED A NON-INTEGER VALUE."<<endl;
		   cout<<"ERROR! YOU JUST TYPED A NON-INTEGER VALUE!Enter an integer please"<<endl;

}//first if
{
if((oid == '%'||oid =='^'||oid=='*'||oid =='$'||oid =='#'||oid =='@'||oid =='!'||oid =='~'))
	 cout<<"......"<<endl; 
}/second if
{
if(oid<1&&oid>100)
cout<<"ENTER BETWEEN 1 AND 100"<<endl;
cout<<"Enter"<<endl;
}//third if

the output comes out to be:
ERROR! YOU JUST TYPED A NON-INTEGER VALUE!Enter an integer please
......what are you typing actually?
Enter between 1 and 100

This article has been dead for over six months. Start a new discussion instead.