C programming (Strings and file I/O) Write a program that asks the user for 5 names and 5 scores (0 to 100) for the test, and write the names and scores to a file (test_score.txt). Read the file to find and display the average, lowest, and highest scores. If the name the user enters is "Jacob," assign 100 points to Jacob's score, regardless of what the user enters. Input Example James 80 Peter 76 Amy 67 Jacob 94 Jenny 92 Output Example Jacob has the highest score of 100. Amy has the lowest score of 67. The average of the test is 83
C
Write a program that asks the user for 5 names and 5 scores (0 to 100) for the test, and write the names and scores to a file (test_score.txt). Read the file to find and display the average, lowest, and highest scores. If the name the user enters is "Jacob," assign 100 points to Jacob's score, regardless of what the user enters.
Input Example
James 80
Peter 76
Amy 67
Jacob 94
Jenny 92
Output Example
Jacob has the highest score of 100.
Amy has the lowest score of 67.
The average of the test is 83. // (80+76+67+100+92)/5
Program description :
The main.c program prompts the user to enter the names and scores of 5 students and assign the values into two arrays. Then write the names and scores to the text file, test_score.txt. Check if any name is "Jacob" then write 100 to the score value for Jacob's name. Then close the input file. Then, open the file, test_score.txt, and find the person whose score is high and lowest score student as well as the average score value. Display the student name and highest score, display the student name and lowest score, and average score value on the C console window.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images