Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void display(float, float[] );
- void drinking(float[], float[] );
- void goal (float[] );
- void alarm (void);
- int x=0, z=0;
- int main()
- {
- int iChoice=0;
- float iArray[500];
- float iArray1[500];
- float a=0;
- do {
- printf("\nThis is the program by An Ton\n");
- printf("Choose the option you want:\n");
- printf("1. \tPut the water dissipated\n");
- printf("2. \tSee how much you have drink\n");
- printf("3. \tSet up hourly drinking alarm\n");
- printf("4. \tSet you drinking goal per day\n");
- printf("5. \tQuit!\n");
- printf("Press the number at the option you want\n");
- scanf("%d",&iChoice);
- system("cls");
- switch (iChoice)
- {
- case 1:
- display(a, iArray);
- break;
- case 2:
- drinking(iArray, iArray1);
- break;
- case 3:
- alarm();
- break;
- case 4:
- goal(iArray1);
- break;
- }
- } while (iChoice != 5);
- return 0;
- }
- void display(float Weight, float iArray12[])
- {
- printf("\nThe water dissipated is:");
- scanf("%f",&Weight);
- printf("\nThe water you just drink is %.2f (ML)\n", Weight);
- iArray12[x]= Weight;
- x++;
- }
- void drinking(float iArray2[], float iArray3[])
- {
- int y;
- float Howmuch1=0;
- z++;
- printf("\nThe amount of water you have been drinking is: ");
- for(y=0;y<=x;y++)
- {
- Howmuch1+=iArray2[y];
- }
- printf("%.2f (ML)\n\n",Howmuch1);
- iArray3[z]=Howmuch1;
- }
- void goal(float iArray4[])
- {
- float BWeight=0;
- float Exercise;
- float Veggie;
- int Choice1=0, Choice2=0;
- float Goal=0;
- printf("\nPut your weight here:\n");
- printf("Weight: ");
- scanf("%f",&BWeight);
- system("cls");
- printf("\nHow much exercise do you drink per week\n");
- printf("1. \tOften\n");
- printf("2. \tNot often\n");
- printf("3. \tNot at all\n");
- scanf("%d",&Choice1);
- system("cls");
- switch(Choice1)
- {
- case 1:
- Exercise=700;
- break;
- case 2:
- Exercise=350;
- break;
- case 3:
- Exercise=0;
- break;
- }
- system("cls");
- printf("\nHow often do you eat vegetables and fruits per week\n");
- printf("1. \tOften\n");
- printf("2. \tNot often\n");
- printf("3. \tRarely to no\n");
- scanf("%d",&Choice2);
- system("cls");
- switch(Choice2)
- {
- case 1:
- Veggie=150;
- break;
- case 2:
- Veggie=65;
- break;
- case 3:
- Veggie=25;
- break;
- }
- system("cls");
- Goal= (BWeight/30)*1000+Exercise+Veggie;
- printf("\nThe amount of water you need per day is %.2f (ML)",(BWeight/30)*1000+Exercise+Veggie);
- if (iArray4[z]>Goal)
- {
- printf("\nYou have complete the goal\n");
- } else { printf("\nYou have to drink more\n");
- }
- }
- void alarm(void)
- {
- printf("\nSet the alarm on");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement