I am having trouble getting this linked list to work in C++?

We are having a compiler error that causes a tv screen to pop up banner that claims break or even continue.I am aware it is actually something wrong with our program but I will be at some sort of lost spend money on what it can be.I appeared to be just endeavoring to test the primary function as you can see coming from my most important program end of it.Any help will be deeply appreciated I have been operating non stop about this for days and haven’t figured it out.
Suggestions my header file:

#include
using namespace an std;

struct Node

char cvalue;
two bottle dvalue;
int keyvalue;
Node *next;
;
Suggestions my.cpp file
#include “SimplelinkedListLab_2.h”

course SimpleLinkedList

exclusive:
Node *first; // This is actually the only member variable your own are granted!
arrest:
SimpleLinkedList(); // Default constructor
SimpleLinkedList(); // Destructor have to delete just about all nodes from the list
bool empty(); // returns true in the event that list is actually empty
void insert (char, two bottle, int);
void remove(int);
int listCount();
bool getValue(int, char & c, double & d);
void minValue( char & cval, two bottle & dval);
void maxValue(char & cval, two bottle & dval);
void displayList( ostream & out);
;

SimpleLinkedList::SimpleLinkedList()

first = brand-new Node;
first -> future = NULL;

SimpleLinkedList::SimpleLinkedList()

Node *temp = different Node;
although (first! = NULL)

temp = primary -> upcoming;
delete temp;

bool SimpleLinkedList::empty()

if (first -> future == NULL)
go back true;
else
go back false;

void SimpleLinkedList::insert( char c, double ve had, int key)

char cvalue = c;
two bottle dvalue = ve had;
int keyvalue = key;
Node *tmp = different Node;
tmp -> dvalue = dvalue;
tmp -> cvalue = cvalue;
tmp -> keyvalue = keyvalue;
if (tmp == NULL)
go back;
if (first == NULL crucial keyvalue)

tmp -> next = primary;
first = tmp;

else

Node *pred = first;
although (pred -> future! = NULL && pred -> next -> keyvalue < key)

pred = pred -> next;

tmp -> next = pred -> future;
pred -> next = tmp;

delete tmp;

void SimpleLinkedList::remove(int key)

Node *pred = NULL;
Node *tmp = first;

if (tmp == NULL)
go back;
if (tmp -> keyvalue == key)

first = tmp -> future;
delete tmp;
go back;

tmp = tmp -> next;
although (tmp! = NULL && tmp -> keyvalue! = key)

pred = tmp;
tmp = tmp -> next;

if (tmp! = NULL)

pred -> next = tmp -> future;
delete tmp;

int SimpleLinkedList::listCount()

Node *tmp = first;
int count number = 0;
although (tmp -> keyvalue! = NULL)

count++;

delete tmp;
go back count;

// Returns the amount of nodes within the list.
void SimpleLinkedList::displayList( ostream & out)

Node *tmp = first;
while(tmp! = NULL)

out there < cvalue << " ";
out there < dvalue << " ";
out there < keyvalue << " ";
tmp = tmp -> next;

cout << endl;

bool SimpleLinkedList::getValue(int key, char & c, double & d)

Node *tmp = first;

although (tmp! = NULL && tmp -> keyvalue! = key)

tmp = tmp -> next;

c = tmp -> cvalue;
n = tmp -> dvalue;
if (tmp == NULL)
go back false;
else
go back true;

void SimpleLinkedList::minValue( char & cval, two bottle & dval)

Node *tmp = first;
int min = cval;
two bottle dmin = dval;
although (tmp! = NULL)

if (cval > tmp -> cvalue)
tmp = tmp -> next;
else
min = cval;

delete tmp;
Node *tmp2 = first;
although (tmp! = NULL)

if (dval > tmp -> dvalue)
tmp = tmp -> next;
else
dmin = dval;

delete tmp2;

void SimpleLinkedList::maxValue(char & cval, two bottle & dval)

Node *tmp = first;
int maximum = cval;
two bottle dmax = dval;
although (tmp! = NULL)

if (cval > tmp -> cvalue)
tmp = tmp -> next;
else
maximum = cval;

delete tmp;
Node *tmp2 = first;
although (tmp! = NULL)

if (dval > tmp -> dvalue)
tmp = tmp -> next;
else
maximum = dval;

delete tmp2;
;

int major ()

SimpleLinkedList listing;
listing.insert(‘A’, ONE, 1);
listing.displayList(cout);
procedure (“PAUSE”);

Again almost any help will be much liked.

Yes Ryan.

And suggestions my revised code ( WE wrote it without reading through Ryan sounds )
http://4uploading.com/users/1/main.cpp

I are not aware how you would like to use (minvalue and maxvalue); do you want to send out two varibales that’ll put within them the minimium nature value plus minimum dual value or maybe something different
I modified the tactic (minvalue) to complete like just what exactly I reported above, and remaining (maxvalue) since it is, to help you to choose what exactly is better for you and alter it since you want.

Observe:headers file seriously isn’t modified, and MY PARTNER AND I marked every line we removed or maybe inserted below

Okay, locations things which i can notice:
ONE.When everyone destruct any linked list that you do not create fresh nodes.What you need to do is assign a pointer (curr) to point during you the best node of the list.You then allow bonce pointer = head->next then delete curr;

ONLY TWO.When everyone construct a linked list credit card debt settlement with first = NULL; You do not create your node.The development of Nodes are usually all done if you insert into your list.Constructing at creates a instance from the object in addition to initializes your data members.

THREE.All you need to do to determine if any linked listing is vacant is if(first == NULL).First points to the first node within the list.first->next can be what the 1st mode details to.If your linked checklist has first->next == NULL; that will make the actual list have got a size connected with one.First (or head) suggestion points to help nothing around an drain list.

SEVERAL.
void SimpleLinkedList::insert( char c, double ve had, int key)

char cvalue = c; //redundant
/*Okay, thte very first thing you need to do should be to create a fresh node.Then assign the actual nodes records items for the reason that parameters which you passed.

Leave a Reply