subject
Computers and Technology, 01.12.2020 04:40 zara76

C++ please. How can I implement the function definition (where the comment block on definitions. cpp is)? I am using a three file format and have attached the three files (definitons. cpp, header. h, main. cpp). The definitons. cpp file is the ONLY file that needs modification.

DEFINITIONS. CPP

/*
Name: Daniel Olivares
Class: CptS 121, Fall 2020
Date: November 30, 2020
U7 Vector Participation 11-30 Starter Code
Description: This program solves a vectors practice problem
Notes:
*/

#include "header. h"

/
* Function: importPackagesLog ()
* Date Created: 11/27/20
* Date Last Modified: 11/27/20
* Description: This function reads a data set from an input file
* and stores each line of package data in a
* corresponding vector
* Input parameters: output parameter variables for names, sizes,
* and weights of packages
* Returns: N/A
* Pre: The input file contains a list name and one or more sets of
* package data consisting of recipient name, package size,
* and package weight
* Post: Each package data from the input file is now stored in a
* set of parallel vectors
/

//
// WRITE YOUR FUNCTION DEFINITION HERE
//

/
* Function: printPackageList ()
* Date Created: 11/27/20
* Date Last Modified: 11/27/20
* Description: This prints the contents of the package list read
* from file
* Input parameters: package list name, a vector of names, sizes,
* and weights of packages
* Returns: true if package list name is not an empty string and
* all vectors are the same size
* Pre: The input string and vectors are not empty (at least one
* item read from the input file)
* Post: Each package data is printed to the console output
/

bool printPackageList(string packagesListName, vector names, vector sizes, vector weights)
{
//If our list name is not an empty string and our vectors are the same size...
if (packagesListName. size() > 0 && (names. size() == sizes. size() && names. size() == weights. size()))
{
cout //need for console IO
#include //don't forget to include libraries if we are using their functions!
#include //need for file IO
#include //need for vectors
#include //need for fixed precision output

using namespace std;

//complete the definition for this prototype
void importPackagesLog(ifstream&, vector &, vector &, vector &);

bool printPackageList(string, vector , vector , vector );

#endif // !HEADER_H

MAIN. CPP

/*
Name: Daniel Olivares
Class: CptS 121, Fall 2020
Date: November 30, 2020
U7 Vector Participation 11-30 Starter Code
Description: This program solves a vectors practice problem
Notes: see inline comments
main cpp file -- should only contain our main() function!
only one include to the header file
*/

#include "header. h" //notice the include uses " --> this indicates this is a FILE PATH

int main() {
string inputFileName = "packages. log";
string line = "", packageListName = "";
bool readSuccess = false;

//These are three EMPTY vectors! They have NO size!
//We CANNOT access them using an index value while the are empty!
//We have to INCREASE their size when adding new items to our vector
//(hint: see vector member functions)
//We are using these as three PARALLEL vectors -- you should be familiar with this
//concept, if not, use this as a chance to ask for help or look it up! (hint it's important)
vector names;
vector sizes;
vector weights;

ifstream infile;
infile. open(inputFileName);

//test file is open
if (!infile. is_open())
{
cout << "Failed to open " << inputFileName << ". Exiting program." << endl;
return -1;
}

//read package list name
getline(infile, packageListName);
//get rid of the newline
getline(infile, line);

//Task: complete the function definition given the function prototype and function call
importPackagesLog(infile, names, sizes, weights);

readSuccess = printPackageList(packageListName, names, sizes, weights);

if (readSuccess)
cout << "Successfully read the packages list!" << endl;
else
cout << "Failed to read the packages list!" << endl;

return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 12:40
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Whose task it is to ensure that the product flows logically from one step to another?
Answers: 3
question
Computers and Technology, 24.06.2019 05:50
What all vehicles has tesla inc. created over the years
Answers: 3
You know the right answer?
C++ please. How can I implement the function definition (where the comment block on definitions. cp...
Questions
question
Mathematics, 21.06.2021 17:00