[Solved]-Using Code Unaltered Create C Program Sort Data Maps Vectors Display Data Match Perfectly Q37179744
Using the code below unaltered, how do I create a c++ program tosort the data into maps and vectors and then display the data tomatch up perfectly with the expected output?
|———————————Code Provided–CannotChange—————————————————-|
#include <iostream>#include <fstream>#include <string>#include “productiondb.h” //need to create#include “entry.h” // need to create#include “reporter.h” //need to createusing namespace std;int main(int argc,char* argv[]){ productiondb db; if (argc != 2) { cout << “Usage: ” << argv[0] << ” <datafile>” << endl; exit(0); } // Read the data char* datafile = argv[1]; ifstream infile(datafile); int year; int month; int day; string station; string resource; int amount; while (!infile.eof()) { infile >> year; infile >> month; infile >> day; infile >> station; infile >> resource; infile >> amount; if (!infile.eof()) { entry oneEntry(year,month,day,station,resource,amount); db.addData(oneEntry); } } // Output the report reporter reporter(db); for (int year = 2045; year <= 2047; year++) { reporter.printFullReport(year); } for (int year = 2045; year <= 2047; year++) { reporter.printStationReport(year); } return(0);}
|———————————-data provided to run programon———————————-|
2045 1 18 Chicago magnesium 9742045 1 7 Alabama chloride 6772045 1 3 BonJovi iron 19412045 1 24 Kansas sodium 2902045 1 15 Boston iron 3262045 1 9 Alabama sodium 4462045 1 13 Journey potassium 10742045 1 16 Chicago potassium 7462045 1 13 Kansas silicon 9682045 1 21 Alabama iron 1872045 2 8 Boston iron 572045 2 23 Alabama sodium 4202045 2 19 Alabama iron 4222045 2 27 Chicago silicon 8152045 2 5 Boston magnesium 5212045 2 15 BonJovi magnesium 4782045 2 15 Chicago magnesium 1252045 2 4 Survivor chloride 2742045 2 20 Journey sodium 7382045 2 1 Alabama potassium 702045 3 18 Chicago iron 3062045 3 13 Survivor chloride 38
|——————ExpectedOutput————————————–|
*******2045*******Station: AlabamaJan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Totchloride 677 0 691 0 0 0 0 0 0 0 243 0 1611iron 187 422 0 0 0 0 605 0 597 0 0 0 1811magnesium 0 0 0 0 0 0 592 600 0 340 0 0 1532potassium 0 70 0 0 267 0 0 0 0 0 0 0 337silicon 0 0 107 0 0 0 0 0 692 295 0 0 1094sodium 446 420 0 0 0 0 0 0 430 0 0 139 1435water 0 0 0 0 0 0 0 0 0 0 425 389 814Station: BonJoviJan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Totchloride 0 0 0 949 0 0 0 0 64 0 0 0 1013iron 1941 0 0 0 0 869 0 1532 0 0 0 0 4342magnesium 0 478 0 0 0 1026 0 1931 764 0 0 733 4932silicon 0 0 0 0 1603 0 0 0 228 531 0 0 2362sodium 0 0 0 456 434 577 0 0 0 0 0 0 1467Station: BostonJan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Totchloride 0 0 0 0 748 0 0 0 0 0 0 0 748iron 326 57 0 0 917 0 0 0 0 0 0 0 1300magnesium 0 521 398 0 0 0 0 0 0 0 719 681 2319potassium 0 0 81 0 0 0 0 0 74 0 0 0 155water 0 0 0 202 0 0 0 0 0 0 0 0 202
Expert Answer
Answer to Using the code below unaltered, how do I create a c++ program to sort the data into maps and vectors and then display th… . . .
OR

