Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Well documented program, telling me what the program is supposed to do.The style should be the one either used in class or by the book

Well documented program, telling me what the program is supposed to do.The style should be the one either used in class or by the book (that is loops designs, explicit choice of variable names, well defined CONSTANT). Avoid using numbers where you can use named constant.Your code should be clear and easy to follow, your main function should be as simple as possible.The following program creates a linked list with three names:

#include

#include

using namespace std;

struct Node

{

string name;

Node *link;

};

typedef Node* NodePtr;

int main(int argc, char** argv) {

NodePtr listPtr, tempPtr;

listPtr = new Node;

listPtr->name = "Emily";

tempPtr = new Node;

tempPtr-> name = "James";

listPtr->link = tempPtr;

tempPtr->link = new Node;

tempPtr = tempPtr->link;

tempPtr -> name = "Joules";

tempPtr -> link = NULL;

//do your work here.

return 0;

}

Add code to the main function that:

  1. Outputs in order all names in the list.

That is you should have something like:

Emily

James

Joules

  1. Insert the name Joshua in the list after James then outputs the modified list.

That is you should have something like:

Emily

James

Joshua

Joules

  1. Delete the node with Joules then outputs the modified list.

That is you should get something like

Emily

James

Joshua

  1. Deletes all nodes in the list.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Combinatorial Testing In Cloud Computing

Authors: Wei-Tek Tsai ,Guanqiu Qi

1st Edition

9811044805, 978-9811044809

More Books

Students also viewed these Programming questions

Question

What are the attributes of a technical decision?

Answered: 1 week ago