Hey all! Finals are over, yes! Ended up with a C in my programming class, and that is really ok with me. Like another user on here said, it is like learning another language, and I was really bad a Spanish :-) But I had a program that was assigned for homework that I never was able to figure out. Since I am the curious sort, I was wondering if anyone wanted to take a crack at it?
The instructions are:
For this program, you are reading from a file, data5.dat. The first column are sequential numbers starting at 1, corresponding to the line number. The second column gives a piece of data (floating point). The third column gives the date and time the data was taken (should read the 10-digit number as an integer long). The forth column contains 1's or 0's that denote if the data is good or not. 1 is good, 0 is bad, therefore discarded.

The data5.dat file I wrote looks like this;
Code:
1  5.421       1202960413  0
2  -223.432  1202960413  1
3  -2.14         226991307   1
4  22.222      905842300   1
5  -27.1234   826430523   0
6  1000.00    826430523   1
7  -27.753   1010071201   1
For the first part, I am supposed to print the good data to the screen. The second part adds the line numbers in, renumbered (so, only the good data, plus the line it is now on). The third part gives the date with the months spelled out. And the forth part adds the time onto the end of it. So, for line 1, the final output should look like;
Code:
1  -223.432  December 2, 1996 at 4:13 AM
I was thinking for the first part, the part where you discard the bad data, that I would use a flag inside a for loop. But not sure how I would initialize it, since the numbers are in the 4th column.

Anyway, anyone feel like taking a crack at it? More for my own knowledge than anything, since I will more than likely be using C again at some point in my engineering education :-)