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++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 3PP: (Data processing) Write a C++ program that allows the user to enter the following information from...
icon
Related questions
Question

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.  // (80+76+67+100+92)/5

 

Expert Solution
Step 1

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

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
User Defined DataType
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr