subject

C++Given a ListItem class, complete main() using the built-in list type to create a linked list called shoppingList. The program should read items from input (ending with -1), adding each item to shoppingList, and output each item in shoppingList using the PrintNodeData() function. Ex. If the input is:-1the output is:.cpp#include "ListItem. h"#include #include #include using namespace std;int main (int argc, char* argv[]) {// TODO: Declare a list called shoppingList of type ListItemstring item;// TODO: Read inputs (items) and add them to the shoppingList list// Read inputs until a -1 is input// TODO: Print the shoppingList list using the PrintNodeData() functionreturn 0;}ListItem. h#ifndef LISTITEMH#define LISTITEMH#include using namespace std;class ListItem {public:ListItem();ListItem(string itemInit);// Print this nodevoid PrintNodeData();private:string item;};#endifListItem. cpp#include "ListItem. h"#include ListItem::ListItem() {item = "";}ListItem::ListItem(string itemInit) {item = itemInit;}// Print this nodevoid ListItem::PrintNodeData() {cout << item << endl;}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:20, mahaleyrenee1195
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 2
image
Computers and Technology, 22.06.2019 20:00, jc624826
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
image
Computers and Technology, 23.06.2019 00:30, devenybates
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
image
Computers and Technology, 23.06.2019 06:30, eddsworldfrantic
You have a small company and want to keep your costs low, but it is important your employees share data. which network would provide you with the most economical solution?
Answers: 1
You know the right answer?
C++Given a ListItem class, complete main() using the built-in list type to create a linked list call...

Questions in other subjects:

Konu
Mathematics, 27.05.2020 14:58