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 03:50
You are working as a security analyst in a company xyz that owns the whole subnet range of 23.0.0.0/8 and 192.168.0.0/8. while monitoring the data, you find a high number of outbound connections. you see that ip's owned by xyz (internal) and private ip's are communicating to a single public ip. therefore, the internal ip's are sending data to the public ip. after further analysis, you find out that this public ip is a blacklisted ip, and the internal communicating devices are compromised. what kind of attack does the above scenario depict?
Answers: 3
question
Computers and Technology, 22.06.2019 17:20
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
question
Computers and Technology, 23.06.2019 15:20
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
question
Computers and Technology, 23.06.2019 20:40
Instruction active describing list features which statements accurately describe the features of word that are used to create lists? check all that apply. the tab key can be used to create a sublist. the enter key can be used to add an item to a list. the numbering feature allows for the use of letters in a list. the numbering feature can change the numbers to bullets in a list. the multilevel list feature provides options for different levels in a list.
Answers: 2
You know the right answer?
C++ please. How can I implement the function definition (where the comment block on definitions. cp...
Questions
Questions on the website: 13722360