I'm a high school Nordic ski coach and I'm trying to write a program in C that will read results from a file, sort them, and print the results to another file. I'm having trouble understanding how to deal with times. I have looked up a bunch of stuff on the time.h library but can't make sense of how to declare the time variables. The input file will look like this:
Johnny Skier 08:00 20:00 Schoolname
With the first number being start time and the second number being fiinsh time.
The results should look like this:
Johnny Skier 12:00 Schoolname
With the 12:00 being elapsed time.
I think I also want the sorted list to be numbered, but that's a minor detail. The main problem I am having is with the time variables.
small note, in your print statement your trying to print strings when your variables are character arrays, you might have a small problem with that.
since this sounds like an HW assignment Im only going to offer advice here. You should focus on pulling out the start time and finnish time from the array a. Anothering you might look at is if a is only 100 chars long what happens if the firstname is the full 115 chars you allow it to be? some things for you to look at and work on.
Thanks. I will play around with those suggestions. Actually, this is not a homework assignment. It is purely to help my conference with scoring ski meets. I took an intro cs class last fall but now I'm taking a Linux course, MS Server 2003 1, and Project Management. I'm a networking student, not a programming student.
Last edited by reneeccski; 01-14-2005 at 05:14 AM..
Well, I don't want to be a spoil sport, but considering it's not a homework assignment and I'm not posting it all for you, here's what I came up with. You still have to write the sorting and output parts, and it's not the most streamlined code in the world, but it works.
Jason: Strings in C are, essentially, character arrays.
Wow. I would have never come up with all that! I'm still learning. Thanks so much. I'm going to have to break this down for myself to understand the what and why of what you've written. So don't worry, I'm not just going to blindly copy and paste!
I do have a question for you. Since there is going to be a space between the skiers' first and last names, does that need to be two separate strings? We did an example in class last semester with batting averages of famous baseball players and we used a string for first and last name separately.
Last edited by reneeccski; 01-14-2005 at 06:55 PM..