Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. void display(float, float[] );
  4. void drinking(float[], float[] );
  5. void goal (float[] );
  6. void alarm (void);
  7. int x=0, z=0;
  8. int main()
  9. {
  10.     int iChoice=0;
  11.     float iArray[500];
  12.     float iArray1[500];
  13.     float a=0;
  14.     do {
  15.     printf("\nThis is the program by An Ton\n");
  16.     printf("Choose the option you want:\n");
  17.     printf("1. \tPut the water dissipated\n");
  18.     printf("2. \tSee how much you have drink\n");
  19.     printf("3. \tSet up hourly drinking alarm\n");
  20.     printf("4. \tSet you drinking goal per day\n");
  21.     printf("5. \tQuit!\n");
  22.     printf("Press the number at the option you want\n");
  23.     scanf("%d",&iChoice);
  24.     system("cls");
  25.     switch (iChoice)
  26.     {
  27.     case 1:
  28.         display(a, iArray);
  29.         break;
  30.     case 2:
  31.         drinking(iArray, iArray1);
  32.         break;
  33.     case 3:
  34.         alarm();
  35.         break;
  36.     case 4:
  37.         goal(iArray1);
  38.         break;
  39.     }
  40.     } while (iChoice != 5);
  41.     return 0;
  42. }
  43. void display(float Weight, float iArray12[])
  44. {
  45.      printf("\nThe water dissipated is:");
  46.      scanf("%f",&Weight);
  47.      printf("\nThe water you just drink is %.2f (ML)\n", Weight);
  48.      iArray12[x]= Weight;
  49.      x++;
  50. }
  51. void drinking(float iArray2[], float iArray3[])
  52. {
  53.     int y;
  54.     float Howmuch1=0;
  55.     z++;
  56.     printf("\nThe amount of water you have been drinking is: ");
  57.     for(y=0;y<=x;y++)
  58.     {
  59.         Howmuch1+=iArray2[y];
  60.     }
  61.     printf("%.2f (ML)\n\n",Howmuch1);
  62.     iArray3[z]=Howmuch1;
  63. }
  64. void goal(float iArray4[])
  65. {
  66.     float BWeight=0;
  67.     float Exercise;
  68.     float Veggie;
  69.     int Choice1=0, Choice2=0;
  70.     float Goal=0;
  71.     printf("\nPut your weight here:\n");
  72.     printf("Weight: ");
  73.     scanf("%f",&BWeight);
  74.     system("cls");
  75.     printf("\nHow much exercise do you drink per week\n");
  76.     printf("1. \tOften\n");
  77.     printf("2. \tNot often\n");
  78.     printf("3. \tNot at all\n");
  79.     scanf("%d",&Choice1);
  80.     system("cls");
  81.     switch(Choice1)
  82.     {
  83.     case 1:
  84.         Exercise=700;
  85.         break;
  86.     case 2:
  87.         Exercise=350;
  88.         break;
  89.     case 3:
  90.         Exercise=0;
  91.         break;
  92.     }
  93.  
  94.     system("cls");
  95.     printf("\nHow often do you eat vegetables and fruits per week\n");
  96.     printf("1. \tOften\n");
  97.     printf("2. \tNot often\n");
  98.     printf("3. \tRarely to no\n");
  99.     scanf("%d",&Choice2);
  100.     system("cls");
  101.     switch(Choice2)
  102.     {
  103.     case 1:
  104.         Veggie=150;
  105.         break;
  106.     case 2:
  107.         Veggie=65;
  108.         break;
  109.     case 3:
  110.         Veggie=25;
  111.         break;
  112.     }
  113.     system("cls");
  114.     Goal= (BWeight/30)*1000+Exercise+Veggie;
  115.     printf("\nThe amount of water you need per day is %.2f (ML)",(BWeight/30)*1000+Exercise+Veggie);
  116.  
  117.     if (iArray4[z]>Goal)
  118.     {
  119.         printf("\nYou have complete the goal\n");
  120.     } else { printf("\nYou have to drink more\n");
  121.     }
  122. }
  123. void alarm(void)
  124. {
  125.     printf("\nSet the alarm on");
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement