I have a project to do where the teacher gives us a .dat file and we have to put it into an array. this .dat file will be added to the directory the run with the program as a.out < scores.dat.
Please tell me how to do this.
Assignment:
You job is to write a program that will read in the golf scores of several players in a golf game. You will then display some statistics about the scores. You will generate an average score and list those players who scored below the average (a good thing!) You will also provide the functionality to show the winning score. The player with the lowest score is the winner.
Below is the main() function you must use in your program:
int main()
{
int scoreList [MAX_PLAYERS]; /* Array to store golf scores */
int numberOfPlayers = 0; /* Total number of scores entered */
float averageScore = 0.0; /* Average golf score */
int winningScore = 0; /* The lowest score */
printf("\nWelcome to CMSC104's Golf Statistics Program!\n\n");
/* Fill array with golf scores */
numberOfPlayers = FillGolfScoreList (scoreList);
Thankyou