Computer Programming Contest Preparation

ToolBox - Source for: 125/12577/a.c



/home/toolbox/public_html/solutions/125/12577/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 257
   16 
   17 /*
   18  *  Author: Isaac Traxler
   19  *    Date:
   20  * Purpose: fun
   21  * Problem:
   22  */
   23 
   24 /*
   25  * This template reads lines of data at a time until end of file.
   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 
   45     fgets(line, MAX_LINE, stdin);
   46     if ('*' == line[0])
   47         dataReadFlag = FALSE;
   48     else
   49         {
   50             /* something to read */
   51             dataReadFlag = TRUE;
   52             line[strlen(line)-1] = 0;
   53         } /* something to read */
   54     return (dataReadFlag);
   55 } /* FUNCTION getInput */
   56 
   57 void process()
   58 {
   59     /* FUNCTION process */
   60     if ('H' == line[0])
   61         {
   62             /* Hajj */
   63             printf("Hajj-e-Akbar\n");
   64         } /* Hajj */
   65     else
   66         {
   67             /* Umrah */
   68             printf("Hajj-e-Asghar\n");
   69         } /* Umrah */
   70 } /* FUNCTION process */
   71 
   72 int main()
   73 {
   74     /* main */
   75     int moreToDo;
   76     int cs = 0;
   77 
   78     init();
   79     moreToDo = getInput();
   80     while (moreToDo)
   81         {
   82             /* while */
   83             cs++;
   84             printf("Case %d: ", cs);
   85             process();
   86             moreToDo = getInput();
   87         } /* while */
   88 
   89     return EXIT_SUCCESS;
   90 } /* main */
   91