/home/toolbox/public_html/solutions/122/12250/a.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdint.h>
7 #include <math.h>
8 #include <stdlib.h>
9
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 #define MAX_LINE 100
16
17 /*
18 * Author: Isaac Traxler
19 * Date: 2014-10-26
20 * Purpose: UVA Hack-a-thon
21 * Problem: 12250 - Language Detection
22 */
23
24 /*
25 * This template reads data until a terminating value is reached.
26 */
27
28 char line[MAX_LINE];
29
30 void init()
31 {
32 /* FUNCTION init */
33 } /* FUNCTION init */
34
35 void dump()
36 {
37 /* FUNCTION dump */
38 } /* FUNCTION dump */
39
40 int getInput()
41 {
42 /* FUNCTION getInput */
43 int dataReadFlag;
44 scanf(" %s ", line);
45 DEBUG printf("line = [%s]\n", line);
46 dataReadFlag = ('#' != line[0]);
47 return (dataReadFlag);
48 } /* FUNCTION getInput */
49
50 void process()
51 {
52 /* FUNCTION process */
53 if (0 == strcmp("HELLO", line))
54 printf("ENGLISH\n");
55 else if (0 == strcmp("HOLA", line))
56 printf("SPANISH\n");
57 else if (0 == strcmp("HALLO", line))
58 printf("GERMAN\n");
59 else if (0 == strcmp("BONJOUR", line))
60 printf("FRENCH\n");
61 else if (0 == strcmp("CIAO", line))
62 printf("ITALIAN\n");
63 else if (0 == strcmp("ZDRAVSTVUJTE", line))
64 printf("RUSSIAN\n");
65 else
66 printf("UNKNOWN\n");
67 } /* FUNCTION process */
68
69 int main ()
70 {
71 /* main */
72 int moreToDo;
73 int caseNum = 1;
74
75 init();
76 moreToDo = getInput();
77 while (moreToDo)
78 {
79 /* while */
80 printf("Case %d: ", caseNum);
81 caseNum++;
82 process();
83 moreToDo = getInput();
84 } /* while */
85
86 return EXIT_SUCCESS;
87 } /* main */
88