Problem Type : Ad Hoc
#include<stdio.h>
#include<string.h>
int main()
{
char ch[]="HELLO",line[]="HOLA",str[]="HALLO",stv[]="BONJOUR",std[]="CIAO",liv[]="ZDRAVSTVUJTE",des[20];
char c[]="#";
int count=0;
while(gets(des))
{
if(strcmp(des,ch)==0)
{
count++;
printf("Case %d: ENGLISH\n",count);
}
else if(strcmp(des,line)==0)
{
count++;
printf("Case %d: SPANISH\n",count);
}
else if(strcmp(des,str)==0)
{
count++;
printf("Case %d: GERMAN\n",count);
}
else if(strcmp(des,stv)==0)
{
count++;
printf("Case %d: FRENCH\n",count);
}
else if(strcmp(des,std)==0)
{
count++;
printf("Case %d: ITALIAN\n",count);
}
else if(strcmp(des,liv)==0)
{
count++;
printf("Case %d: RUSSIAN\n",count);
}
else if(strcmp(des,c)==0)
break;
else
{
count++;
printf("Case %d: UNKNOWN\n",count);
}
}
return 0;
}
#include<stdio.h>
#include<string.h>
int main()
{
char ch[]="HELLO",line[]="HOLA",str[]="HALLO",stv[]="BONJOUR",std[]="CIAO",liv[]="ZDRAVSTVUJTE",des[20];
char c[]="#";
int count=0;
while(gets(des))
{
if(strcmp(des,ch)==0)
{
count++;
printf("Case %d: ENGLISH\n",count);
}
else if(strcmp(des,line)==0)
{
count++;
printf("Case %d: SPANISH\n",count);
}
else if(strcmp(des,str)==0)
{
count++;
printf("Case %d: GERMAN\n",count);
}
else if(strcmp(des,stv)==0)
{
count++;
printf("Case %d: FRENCH\n",count);
}
else if(strcmp(des,std)==0)
{
count++;
printf("Case %d: ITALIAN\n",count);
}
else if(strcmp(des,liv)==0)
{
count++;
printf("Case %d: RUSSIAN\n",count);
}
else if(strcmp(des,c)==0)
break;
else
{
count++;
printf("Case %d: UNKNOWN\n",count);
}
}
return 0;
}
No comments:
Post a Comment