Hello,
I was wondering if someone can help me with file input and output.
I basically have golf.txt document that contains data from 8 golfers' scores while playing a game of golf. I used the data in the golf.txt document to create a program that read values from the .txt document and calculates the total score of each golfer. However, now i need to take it a step further and create a program that compares each golfers score to the par score and outputs a value for hole by hole.
The program should output 18 different values for each golfer, where each value will contain (the number of tries- par score= score for that hole) and there are 18 holes in a game of golf so it make sense
Each letter represents each golfers score on each hole. (A for hole 1, B for hole 2..... R for hole 18)
It should look something like this for each golfer:
Golfer #1’s score: A B C D E F G.....R
Golfer #2.................
Golfer #3..................
This should not be too hard because I have it all the data I need in my golf.txt file:
8 // This is the number of golfers
4 4 3 5 4 3 4 5 6 5 4 4 4 5 5 4 3 3 // these are the par scores
4 4 3 6 7 4 4 5 4 5 3 5 3 5 7 5 3 2 // for here down is each of the eight golfers score
4 5 3 4 6 5 5 6 3 5 4 6 3 3 5 4 5 3
3 4 5 6 4 4 4 5 5 5 4 5 4 3 3 5 4 3
2 5 5 6 7 6 5 5 4 6 4 5 6 7 5 5 5 5
4 5 6 3 3 5 4 4 3 3 2 5 6 6 5 5 3 3
2 5 3 5 5 5 6 5 4 3 4 5 5 4 4 6 5 5
6 5 4 5 5 3 5 6 5 4 6 5 6 4 4 6 5 4
4 4 5 5 3 3 6 5 4 3 3 5 6 5 3 6 5 4
MY QUESTIONS:
1) Would arrays be the best way to go about completing this program?
2) Would I need a 1d or 2d array to complete this program?
3) If so, I am completely new to arrays! can anyone help me understand how I would set it up? I know that the basic format is something like int numbers [rows][columns]
4) How would I add/ subtract array's positions from each other (for example row 2 column 3 + row 2 column 4) ?
Thank You,
Matt H.