i have my program here and its showing one warning . can u look and tell ehats wrong .
l Home 8:43 PM 38% Here is the code divided into.h and.cpp files. Class definitions usually are placed into.h files, in this case both the class definition i.e. node and linkedlist are placed in one header file. Rest of the code including body of methods belonging to each class and the main function is part of linkedlist.cpp file. #ifndef _LINKEDLIST_H_ linkedlist.h #define _LINKEDLIST_H_ class node private: int data; node *next; public: node (int); void set (int); int get(); void setNext (node *); node *getNext 0); void showData(); class LinkedList private: node * headNode; node *currentNode; int size; public: Linked List 0; void start (); void next(); int get(); int length(); void add (int d); void update (int d); void remove(); void find (int d); void showList 0); #endif linkedlist.cpp linkedlist.cpp #include
#include "linkedlist.h" using namespace std; /Node class method definitions node::node (int x) { set (x); next = NULL; } void int node::set (int x) node::get() { data = x; return data; } void node * node::setNext (node *ptr) node::getNext () { { next = ptr; return next; } void node::showData() { cout getNext () != NULL) { currentNode = currentNode->getNext (); } int LinkedList::get() { if (currentNode != NULL) { return currentNode->get(); } int LinkedList::length 0) return size; void LinkedList::add (int d) LinkedList::add (int d) { node *newNode = new node (d); if (size == 0) { currentNode = newNode; headNode = newNode; currentNode->setNext (headNode); } else { newNode->setNext (currentNode- >getNext (); currentNode->setNext (newNode); currentNode = newNode; } size++; } void LinkedList::update (int d) { if (currentNode != NULL) { currentNode->set (d); } } void LinkedList::remove() { if (currentNode != NULL) { if (currentNode != headNode) if (currentNode != neadNode) { node *ptr; ptr = headNode; while (ptr->getNext () != currentNode) { ptr = ptr->getNext (); } cout getNext 0->get() setNext (currentNode->getNext 0); currentNode = ptr; size- } else { currentNode = currentNode->getNext 0; node *ptr; ptr = headNode; while (ptr->getNext () != headNode) { ptr = ptr->getNext (); } cout getNext 0->get() setNext (currentNode); headNode = currentNode; size- } } else } } else { cout get() == d) { cout getNext (); } while (ptr != headNode); void LinkedList::showList () node *ptr; ptr = headNode; do 38% Home 8:44 PM ptr->showData(); ptr = ptr->gettext 0 of 1 } while (ptr != headNode); cout > spaces; for (int i = 1; i >x; 1.add (x); } I.showList (); cout 1) { int i; for (i = 0; i