Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help solving this C++ problem please. A data file will be provided that contains the first names and student IDs for a class.

I need help solving this C++ problem please.

A data file will be provided that contains the first names and student IDs for a class. Write a program that stores this information using parallel arrays in C++. Assume that the data file will be named "students.txt" and will contain information with no more than 100 students. You can also assume that none of the first names will contain any spaces.

The program will need to contain four functions:

  • Read data from the file into the parallel arrays. The function should also update the number of students actually read in from the file.
  • Print the contents of the arrays. Column headings should be displayed. Use the setw command to have the names aligned to the left. Use the setfill command to display leading zeroes for IDs so that 8 total digits will be displayed.
  • Sort the arrays alphabetically by students' first names. Whenever two names are swapped, the corresponding IDs should also be swapped.
  • Search for a student based on a given student ID. Return the position of the matching item. If an ID does not exist, -1 should be returned.
  • With a main driver program that will test all of these functions.

students.txt datafile:

Austin 00394872

Brett 00705316

Alex 00860156

Marie 00303380

Alexander 00719414

Josh 00600454

Ash 00443106

Jeff 00440146

Paul 00858506

Sylver 00078130

Nate 00524363

Ryan 00346789

Jeff 00819283

Luke 00586747

Harris 00975479

Justin 00661436

Landon 00745369

Garett 00340421

Dylan 00775204

Amber 00991895

William 00700297

Surya 00346965

Shiv 00511067

Mary 00507019

Trennie 00046832

Hangyang 00099012

Isaac 00198113

Kirstie 00143051

ShengLiang 00953869

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. When should you not use a buffer? (LO 10-3)

Answered: 1 week ago