UVa 12250 - Language Detection

Contents

  1. 1. Problem
  2. 2. Solution
  3. 3. Code

Problem

中文網址

Solution

簡單題

Code

UVa 12250
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
#include<cstdio>
#include<cstring>

int main()
{
char str[16];
int Case = 1;
while (fgets(str, 16, stdin) && str[0] != '#')
{
printf("Case %d: ", Case++);
if (!strcmp(str, "HELLO\n"))
puts("ENGLISH");
else if (!strcmp(str, "HOLA\n"))
puts("SPANISH");
else if (!strcmp(str, "HALLO\n"))
puts("GERMAN");
else if (!strcmp(str, "BONJOUR\n"))
puts("FRENCH");
else if (!strcmp(str, "CIAO\n"))
puts("ITALIAN");
else if (!strcmp(str, "ZDRAVSTVUJTE\n"))
puts("RUSSIAN");
else
puts("UNKNOWN");
}

return 0;
}