Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!think.com!paperboy!hsdndev!husc6!genrad!stardent!joep From: joep@Stardent.COM (Joe Peterson) Newsgroups: rec.skydiving Subject: Program to calculate freefall times, etc. Message-ID: <1991May3.144811.4348@Stardent.COM> Date: 3 May 91 14:48:11 GMT Organization: Stardent Computer, Concord MA Lines: 144 Since people seem interested in programs to calculate logbook info, I thought I would post the program I use. It is fairly simple. It looks for a file called "logbook.dat", while is a series of lines such as: 9000 45 3500 10 8000 39 0 0 This would be three jumps (the last 0 0 is an end marker). The first number on each line is the altitude, and the second is the freefall time in seconds. The program calculates total jumps, freefall jumps (more than 0 seconds), and total freefall time. It also prints a chart similar to the one you need for your license application (I think this might be a time saver!). Enjoy! Joe Peterson C-20351 /* Logbook program - Joe Peterson */ #include #define MAX_JUMPS 1000 int jump_chart[(MAX_JUMPS-1)/10+1][5], total[5]; main() { FILE *in; int jumps, freefalls, hours, mins, secs; int altitude[MAX_JUMPS], time[MAX_JUMPS]; int i, group, num_groups; in= fopen("logbook.dat", "r"); jumps= 0; hours= mins= secs= 0; while (1) { fscanf(in, "%d %d", &altitude[jumps], &time[jumps]); if (altitude[jumps] == 0) break; ++jumps; } fclose(in); for (group=0; group<(MAX_JUMPS/10); ++group) for (i=0; i<5; ++i) jump_chart[group][i]= 0; for (i=0; i<5; ++i) total[i]= 0; freefalls= 0; for (i=0; i= 60) { ++mins; if (mins == 60) { ++hours; mins= 0; } secs -= 60; } } num_groups= (jumps - 1) / 10 + 1; printf(" "); for (group=0; group