ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

c++ program

by | Nov 30, 2023 | questions

write a program that will process a data set of information for the Chicago Blackhawks. The information in the file will be needed for later processing, so it
will be stored in a set of arrays that will be displayed, sorted, and displayed (again).

For the assignment, declare four arrays, each of which will hold a maximum of 25 elements:

  • one array of strings to hold the player names
  • one array of integers to hold the number of goals scored for each of the players
  • one array of integers to hold the number of assists for each of the players
  • one array of integers to hold the plus/minus rating for each of the players

The four arrays will be parallel arrays. This means that the information for one player can be found in the same “spot” in each array. This also means that any
time information is moved in one array the same move must be made to the other arrays in order to maintain data integrity.

buildArrays notes:

  • The data is being read from an input file. Before the file can be processed, you must:

  1. declare an input file stream (see “Programming Note 1” below)

ifstream inFile;

open the file and make sure that it opened correctly

inFile.open( “hockey.txt” );
if ( inFile.fail() )
{
cout

The above code will open the file and then make sure that the file did indeed open correctly.

To read from a file, use the name of the ifstream in place of cin. For example if you want to read an integer:

int num;
inFile >> num;

Or if you want to read a string:

string str;
inFile >> str;

To test if there are records in the file, simply use the name of the input file stream as a boolean variable. For example:

while ( inFile )

As long as there are records in the file, the name of the input file stream name will resolve to true. Once all of the records have been read from the
file, the input file stream name will resolve to false.

Once a value has been read from a file, it can be put into the appropriate array element:

goals[i] = num;

After all of the data has been read from the file, the file must be closed. To do this, execute the following:

inFile.close();

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!