hello,
I think I have a rather straightforward problem, but I'm relatively new to C. I have an input file that looks like this:
0.682448 0.53791 0.61727 0.48714
0.297144 0.29688 0.40549 0.68233
0.426100 0.62057 0.25095 0.54782
0.673007 0.51040 0.25476 0.35149
0.641339 0.49815 0.54557 0.42673
0.268030 0.38949 0.48841 0.56580
...
I need to compute x=p*log(p), where p corresponds to one element in my array, say 0.682448. and then, I need to add, let's say, the first 8 'x' values (the first two rows). I need to send that value to an external file, and keep doing it until I reach the end of the file.
I'm not sure how to import the individual float values and how to advance to the next line and how to stop after 2 lines and sum all the values up and then resume the process. I can have the external file formated so that the individual values are either separated by a single space or by a TAB.
I appreciate any suggestions.
r.