Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Best way to do this

Name: Alex 2011-11-24 18:12

Hey /g/. I'm doing an assignment and it asks me to read in a bunch of integers from a text file into an array (marks for assignments). I have an array[10][4], 10 students with 4 grades each.

What I want to do is check the value of these grades, and if they're say <=40, then do something, if they're >70, do something. I need to count up the number of marks in each bracket. I could easily do this using for loops in the main function, but it seems very messy and we're marked on the way we implement the program rather than simply solving the problem.

I tried to use the array as a parameter to a function, and then use the function to check the values, but I couldn't get this to work. Could I use pointers to do this? Jus tell me the best way to do it /g/, I can try to implement it myself. The language is C, by the way.

Name: Anonymous 2011-11-24 18:39

>>9

I could already do this, but I thought that there might have been a better way to go about it, using pointers or something like that. If this is the best way then surely they'll be happy with it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List