/* Collapse point is a running term defining the theoretical
distance an athlete's previous training has equipped them to
 complete. This calculates what distance a runner should be
able to run based on his or her current mileage or how much
someone needs to run to complete a certain distance. */


#include <stdio.h>
#include <stdlib.h>
int main()


{
    int choice, mpw, rd;
    float miles_needed, cp;

    puts("!!! Collapse Point Calculator !!!\n");

    puts("\nCollapse point is a running term");
    puts("defining the theoretical distance");
    puts("an athlete's previous training has
         equipped them to complete.");
    puts("It states that a runner can complete
         three times");
    puts("his or her daily average before
         they reach exhaustion."); 

    puts("\nEnter option 1 to find your
         collapse point.");
    puts("\nEnter option 2 to find out
        how many miles you must run");
    puts("per week for a given event.");

    scanf("%d", &choice);
    if(choice == 1)


        {
        system("CLS");
        puts("You entered option 1.");
        printf("Enter your weekly mileage: ");
        scanf("%d", &mpw);
        cp = (mpw/7)* 3;
        printf("\nYour collapse point is
               %.2f miles.\n", cp);
    }

    else


     {
        system("CLS");
        puts("You entered option 2.");
        puts("\nPick from the following
              race distances:");
        puts("1.) 5K (3.1 miles)");
        puts("2.) 10K (6.2 miles)");
        puts("3.) 10 Miles");
        puts("4.) Half-marathon (13.1 miles)");
        puts("5.) Marathon (26.2 miles)");
        printf("\nEnter number of »
		race distance: ");
        scanf("%d", &rd);
        switch (rd)


     {
         case 1:
         printf("You must run %.2f miles »
		 per week to",
                 miles_needed = (3.1/3)*7);
         printf(" comfortably finish a 5K.\n\n");
         break;

         case 2:
         printf("You must run %.2f miles »
		per week to",
                miles_needed = (6.2/3)*7);
         printf(" comfortably finish a 10K.\n\n");
         break;

         case 3:
         printf("You must run %.2f miles »
		per week to",
                miles_needed = (10 / 3)*7);
         printf(" comfortably finish »
		a 10-mile race.\n\n");
         break;

         case 4:
         printf("You must run %.2f miles »
		per week to",
                miles_needed = (13.1/3) * 7);
         printf(" comfortably finish »
		a half-marathon.\n\n");
         break;

         case 5:
         printf("You must run %.2f miles »
		per week to",
                miles_needed = (26.2/3)*7);
         printf(" comfortably finish »
		a marathon.\n\n");
         break;

         default:
         printf("You either run too much »
		or not enough!!!\n");
     }

  }

    system("PAUSE");	
    return 0;
}


:: Top ::

code dog Tucker
E2 logo
End Poverty
Debt AIDS Trade Africa
World Community Grid
Valid XHTML 1.0 Transitional