I hope people don't mind me posting these here, let me know if you do and I'll find a more appropriate geek list to post them.
The C program I'm working on at the moment is taking a list from a data file and populating an array to either be outputted either to screen, file or printer. the foo.dat file is like this: F 26 5 F 64 4 F 29 2 M 12 3 M 40 1 ...snip... So I need to populate (using count++) a two-dimensional array based on whether the first column is M or F the second column is within a range and whether the thrid column is either 1,2,3,4or5 This is the part that's doing my head in, I could do it using a very convoluted if-else-if loop which would end up giving me a massive and hard to maintain piece of code ie: if line == (F && < 25) && 1) then count++ to array[0][0] else if line == (F && < 25) && 2) then count++ to array[1][0] etc, etc, etc, (code won't compile - made it more human readable for mostly my sake...) doing it this way I would end up with 25 if-else-if statements. is there a way to take the && 1) section read the number from the third coloumn from the foo.dat file and minus one from it? This would give me the x axis of the array - or am I barking completly up the wrong tree? Or is there a better way to do this? any pointers would be appreciated. Kerry ps, I hope I'm making some kind of sense with all of this.....
