Computer Programming Contest Preparation

ToolBox - Source for: 119/11984/a.c



/home/toolbox/public_html/solutions/119/11984/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 #include <ctype.h>
   10 
   11 #define TRUE  (1 == 1)
   12 #define FALSE (1 != 1)
   13 
   14 #define DEBUG if (FALSE)
   15 
   16 /* fprintf(stderr, "functionName: message", varslist); */
   17 
   18 /*
   19  *  Author: Isaac Traxler
   20  *    Date: 2022-10-26
   21  * Purpose: fun
   22  * Problem: 11984 - A Change in Thermal Unit
   23  */
   24 
   25 /*
   26  * This template reads data a specified number of times.
   27  */
   28 
   29 int numberOfTimes;
   30 double temp;
   31 double change;
   32 double final;
   33 
   34 void init()
   35 {
   36     /* FUNCTION init */
   37     scanf("%d ", &numberOfTimes);
   38 } /* FUNCTION init */
   39 
   40 void dump()
   41 {
   42     /* FUNCTION dump */
   43 } /* FUNCTION dump */
   44 
   45 void getInput()
   46 {
   47     /* FUNCTION getInput */
   48     scanf(" %lf %lf ", &temp, &change);
   49 } /* FUNCTION getInput */
   50 
   51 void process()
   52 {
   53     /* FUNCTION process */
   54     /* temp (in celsius) * change (in far) * factor
   55      * factor = 180 / 100 (Farenheit goes from 32-212 (180 degrees) while celsius goes from 0 - 100
   56      */
   57     final = temp + ((change * 100) / 180);
   58     printf("%.2lf\n", final);
   59 } /* FUNCTION process */
   60 
   61 int main()
   62 {
   63     /* main */
   64     int i;
   65 
   66     init();
   67     for (i=1; i<=numberOfTimes; i++)
   68         {
   69             /* while */
   70             getInput();
   71             printf("Case %d: ", i);
   72             process();
   73         } /* while */
   74 
   75     return EXIT_SUCCESS;
   76 } /* main */
   77 
   78