finalcscproject

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

Info iconThis 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);
Background image of page 1

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

View Full DocumentRight 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. ** ** Variables:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2008 for the course CSC 234 taught by Professor Hutch during the Spring '08 term at Cal Poly.

Page1 / 8

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online