Computer Programming Contest Preparation

ToolBox - Source for: 11/1124/a.c



/home/toolbox/public_html/solutions/11/1124/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 <stdlib.h>
    7 #include <math.h>
    8 #include <stdint.h>
    9 
   10 #define TRUE  (1 == 1)
   11 #define FALSE (1 != 1)
   12 
   13 #define DEBUG if (FALSE)
   14 #define MAX_LINE 133
   15 
   16 /* fprintf(stderr, "functionName: message", varslist); */
   17 
   18 /*
   19  *  Author: Isaac Traxler
   20  *    Date: 2014-10
   21  * Purpose: fun
   22  * Problem: 1124 - Celebrity Jeopardy
   23  */
   24 
   25 /*
   26  * This template reads data a specified number of times.
   27  */
   28 
   29 char line[MAX_LINE];
   30 
   31 void dump()
   32 {
   33     /* FUNCTION dump */
   34 } /* FUNCTION dump */
   35 
   36 int getInput()
   37 {
   38     /* FUNCTION getInput */
   39     int dataReadFlag;
   40 
   41     fgets(line, MAX_LINE, stdin);
   42     line[strlen(line)-1] = '\0';   /* take care of newline */
   43     dataReadFlag = ! feof(stdin);
   44     return (dataReadFlag);
   45 } /* FUNCTION getInput */
   46 
   47 void process()
   48 {
   49     /* FUNCTION process */
   50     printf("%s\n", line);
   51 } /* FUNCTION process */
   52 
   53 int main ()
   54 {
   55     /* main */
   56     int moreToDo;
   57 
   58     moreToDo = getInput();
   59     while (moreToDo)
   60         {
   61             /* while */
   62             process();
   63             moreToDo = getInput();
   64         } /* while */
   65 
   66     return EXIT_SUCCESS;
   67 } /* main */
   68 
   69