C++ Only Create a function named PrintStudents, which takes a string input filename and an integer minimum...

70.2K

Verified Solution

Question

Programming

C++ Only

Create a function named PrintStudents,which takes a string input filename and an integer minimum scorevalue and a string output file name as a parameters. The functionwill read the student scores and names from the file and output thenames of the students with scores greater than or equal to thevalue given. This function returns the integer number of entriesread from the file. If the input file cannot be opened, return -1and do not print anything to the file.

Read each line from the given filename, parse the data, processthe data, and write the required information to the file.

Each line of the file contains ,, . Read and parse the data, thenwrite to the output file the names and classes for scores matchingthe criteria.

Example: With the following data and value of 80:

Constance Shelton, 67, APPM 2002Charlotte Edwards, 85, CSCI 1300Alyssa Hill, 78, MATH 1000Pat Owens, 75, HUMN 1342Shannon Jimenez, 96, LING 2000Kristen Swanson, 80, PSYC 1001Jim Schwartz, 60, CVEN 3241

Your function should return 7 and output to the file shouldcontain:

Charlotte Edwards, CSCI 1300Shannon Jimenez, LING 200Kristen Swanson, PSYC 1001

You only need to write the function code forPrintStudents. The split()function is provided, and functions as it does in the homeworkassignments, to make parsing the output easier. Recall thatsplit takes a string s and splitsit at the input delimiter sep, to fill the arraywords[] up to a capacity ofmax_words. The return value ofsplit is the number of actual words the string issplit into.

int split(string s, char sep, string words[], int max_words);

Answer & Explanation Solved by verified expert
3.8 Ratings (349 Votes)
THE BELOW CODE REPRESENTS THE CODE FOR Cinclude include    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students