2017-07-18 15:14:23
#include<bits\stdc++.h>
using namespace std;
int isnumber(char *str)
{
        int i=0;
        int dot=0;
        int flag=0;
 
        while(str[i]!='\0')
        {
            if((str[i]>='0' && str[i]<='9') || str[i]=='.' && dot<1 )
            {
                if(str[i]=='.')
                    dot++;
            }
            else
            {
                flag=1;
                break;
            }
            i++;
        }
        if(flag==1)
            return 0;
        else if(dot==0 && flag==0)
           return 1;
        else
            return -1;
 
 
 
}
int isoperator(char *str)
{
    int i=0,l;
    l=strlen(str);
    int flag=0;
    if(l==1)
    {
        if(str[0]=='>')
            return 1;
        else if(str[0]=='<')
            return 1;
        else if(str[0]=='=')
            return 1;
        else
            return 0;
 
    }
    else if(l==2)
    {
        if(!strcmp(str,">="))
            return 1;
        else if(!strcmp(str,"<="))
            return 1;
        else if(!strcmp(str,"!="))
            return 1;
        else
            return 0;
    }
    else
        return 0;
}
int iskeyword(char *str)
{
 
    if(!strcmp(str,"int"))
        return 1;
    else if(!strcmp(str,"float"))
        return 1;
    else if(!strcmp(str,"double"))
        return 1;
    else if(!strcmp(str,"char"))
        return 1;
    else if(!strcmp(str,"main"))
        return 1;
    else
        return 0;
}
int isidentifier(char *str)
{
 
        int flag=0,i=1,l;
        l=strlen(str);
        i=1;
        flag=0;
        if(iskeyword(str)==0)
        {
 
 
 
		if((str[0]>='a' && str[0]<='z' )|| (str[0]>='A' && str[0]<='Z') || str[0]=='_' )
		{
            while(l>0 && str[i]!='\0')
            {
                if((str[i]>='a' && str[i]<='z' )|| (str[i]>='A' && str[i]<='Z') || (str[i]>='0' && str[i]<='9')|| str[i]=='_' )
                {
                    i++;
                    l--;
                }
                else
                {
                    flag=1;
                    break;
                }
 
            }
 
        }
        else
           flag=1;
        if(flag)
           return 0;
        else
            return 1;
 
        }
        else
            return -1;
 
 
}
 
int main()
{
    char str[1000];
    char temp[1000][100];
    int l,i,j,k;
    while(gets(str))
    {
        j=0;
        i=0;
        k=0;
        while(str[i]!='\0')
        {
 
            if(str[i]!=' ')
            {
 
                temp[k][j]=str[i];
                j++;
            }
            else if(str[i]==' ')
            {
                temp[k][j]='\0';
                k++;
                j=0;
            }
            i++;
 
        }
        temp[k][j]='\0';
        for(i=0;i<=k;i++)
        {
           if(isnumber(temp[i])==1)
                cout<<endl<<temp[i]<<"\tInteger Number";
            else if(isnumber(temp[i])==-1)
                cout<<endl<<temp[i]<<"\tFloat Number";
           else if(isoperator(temp[i]))
              cout<<endl<<temp[i]<<" \tOperator";
            else if(isidentifier(temp[i])==1)
                cout<<endl<<temp[i]<<" \tNot Identify";
            else if(isidentifier(temp[i])==-1)
                cout<<endl<<temp[i]<<" \tNot Identify";
            else
                cout<<endl<<temp[i]<<" \tNot Identify";
 
 
        }
        cout<<endl;
    }
 
    return 0;
}
 
 
saikat
Invalid Email or Password