finalcscproject - 010:38am hornet ~/csc234> cat...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
010:38am hornet ~/csc234> cat finalproject.c /* ** CSC-234 (M. Hutchenreuther) Tack ** Final Project Section 3 ** June 7, 2007 ** ** Running Log Program ** ** Description: This program displays certain running trails, the length ** Of the trails, the personal records for each trail, the ** average pace of each trail, and the number of times the ** trail has been ran by the runner. It also updates and adds ** trails to the file. ** ** ** Called Units: ReadFile(), DisplayRuns(), addRun(). ** ** ** ** ** Included methods: main() ** ** Variables: ** Name Type Purpose Units Range ** icount int count how many times ran n/a n/a ** ** ** Constants: ** Name Type Purpose Units Value ** None ** ** Inputs: none ** Outputs: none ** ** Revision History: Created 6/07/07 by . */ #include <stdio.h> #include <string.h> #define SECS_PER_HOUR 3600 #define SECS_PER_MIN 60 #define STRSIZ 20 typedef struct { char name[STRSIZ]; double distance; int iprSec; int icount; } run_t; void secsToHMS(int itotalSecs, int *h, int *m, int *s); void findRun(const run_t list[], int inumRuns, const char cname[], int *index); void writeFile(const run_t list[], int inumRuns); void readFile(run_t list[], int *icount);
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
void displayRuns(const run_t list[], int inumRuns); void addRun(run_t list[], int inumRuns); int main(void) { run_t list[30]; int icount; readFile(list, &icount); displayRuns(list, icount); addRun(list, icount); return 0; } /* Function secsToHMS() ** ** Description: This function converts Seconds to Hours, Minutes, and seconds ** ** Variables: ** Name Type Purpose Units Range ** none ** ** ** Parameters: totalSecs ** Returns: hours, minutes, seconds ** ** ** Preconditions: Time has been entered ** Post-Conditions: Time is converted to Hours, minutes, and seconds. ** */ void secsToHMS(int totalSecs, int *h, int *m, int *s) { *s = totalSecs; *h = *s/SECS_PER_HOUR; *s = *s%SECS_PER_HOUR; *m = *s/SECS_PER_MIN; *s = *s%SECS_PER_MIN; } /* Function findRun ** ** Description: This function finds the run inputed.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern