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, 22.06.2019 22:30
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
question
Computers and Technology, 24.06.2019 05:50
What all vehicles has tesla inc. created over the years
Answers: 3
question
Computers and Technology, 24.06.2019 08:30
Intellectual property rights are exclusive rights that protect both the created and the creation. ipr offers exclusively what benefits to the person or people covered by it
Answers: 3
question
Computers and Technology, 24.06.2019 10:00
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
You know the right answer?
C++ please. How can I implement the function definition (where the comment block on definitions. cp...
Questions
question
Mathematics, 20.06.2020 09:57
question
Mathematics, 20.06.2020 09:57
question
Mathematics, 20.06.2020 10:57
Questions on the website: 13722360