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 00:30
Quic which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
question
Computers and Technology, 24.06.2019 02:30
How to apply the fly in effect to objects on a slide
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
What function key is used to enable the spelling and grammar function
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, 31.07.2019 09:10
question
Mathematics, 31.07.2019 09:10
question
Mathematics, 31.07.2019 09:10
Questions on the website: 13722362