Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data structures: In C++ write a simple code to insert, delete and print using while if and for loops, no classes. Have user input data

Data structures: In C++ write a simple code to insert, delete and print using while if and for loops, no classes.

Have user input data with cout and cin. and have the user clarify using ('P' 'I' or 'D' which operation they want for the node) Ex. if(letter='D', ){

Include a counter for nodes counter-1 for delete and counter +1 for insert.

this is what i have so far.

#include using namespace std;

int counter=0;

struct node { int info; node* link; };

cout<<"Enter I-insert P-print D-delete node"<>letter; int main(){ if (letter='I'){ new node; newNode->info=data; newNode->link=head; new node newnode; cin>>newNode->link=head; head=newNode; if(letter='P'){ current=head; while (current->link != NULL){ cout<info; current=current->link; } else if( letter='D') //delete funtion for(i=1, i <= counter; i++){ current=head; cin>>data; if( current->info=data) current->link=current->link->link; cin>>counter; } delete current; } } } }

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

Repeat Problem 9110 using argon as the working fluid.

Answered: 1 week ago

Question

6. Describe to a manager the different types of distance learning.

Answered: 1 week ago

Question

1. Explain how new technologies are influencing training.

Answered: 1 week ago