Computers and Technology

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;}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 21:00, mazolethrin9632
Which of these is most responsible for differences between the twentieth century to the twenty-first century?
Answers: 2
image
Computers and Technology, 23.06.2019 00:30, Thisisdifinite
Which of the following would you find on a network
Answers: 3
image
Computers and Technology, 23.06.2019 07:00, sugaree95
What are three software programs for mobile computing?
Answers: 1
image
Computers and Technology, 23.06.2019 13:50, mrfishyyyy
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
Do you know the correct 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, 18.12.2021 19:20
Konu
English, 18.12.2021 19:20