Hi all, I'm currently doing a couse in C programming and as part of a project I need to take data from a file and use that to populate several fields within my program ie:
I have three colums in foo.txt:
F 26 5
F 64 4
F 29 2
M 12 3
M 40 1
F 38 4
..snip..
I need to get that data (fscanf) then populate a field that looks like this:
CUSTOMER SURVEY REPORT
======================
FEMALES MALES
======================= =======================
younger range older younger range older
than 25 25 - 40 than 40 than 25 25 - 40 than 40
LEAD TYPE ======================= ======================= TOTAL
========= =====
(note, posting this into this forum is removing much of the whitespace from the layout of the table - it's a little prettier on my screen)
I'm having some difficulty getting my head around this, I am assuming I need to take the data from the text file and turn it into an array - this is the part I'm not really getting at the moment, anyone have any ideas which would be the best way to proceeed?
1) Initialise Loop Counter to Zero
2) Read Line
3) Store line in element array[loop counter]
4) Increment Loop Counter
5) Get Next Line
6) Repeat 2-5 until End of File
This gets the data into an array (or set of arrays).
You can them maniputate the data to get the output you require.