online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include<string> using namespace std; class node { public: int data; node *next; node () { data = 0; next = NULL; } void setdata () { cout << "Enter value : "; cin >> data; next = NULL; } }; class linkedlist { private: node * head; int counter =0; public: void inserthead (node * p) { head = p; } node *gethead () { return head; } void insertdata () { node *p; p = new node (); p->setdata (); node *temp; temp = head; if (head == NULL) { head = p; counter++; } else { for (int i = 1; i < counter; i++) { temp = temp->next; } // temp->next = p; temp = p; counter++; } } void deletedata () { if (counter == 0) { cout << "\ncan't delete from an empty linked list:\n"; } else { node *temp2 = head; for (int i = 1; i < counter-1; i++) { temp2 = temp2->next; } temp2->next=NULL; } } void printdata () { if (counter == 0) { cout << "\ncan't print from an empty linked list:\n"; } else { node *temp2 = head; for (int i = 1; i < counter; i++) { cout << "\nvalue : " << temp2->data; temp2 = temp2->next; } } } }; int main () { linkedlist ll; int choice; do { cout << "\nPress 1 for enter data: "; cout << "\nPress 2 for print data: "; cout << "\nPress 3 for delete data: "; cout << "\nPress 4 for exit: "; cin >> choice; switch (choice) { case 1: { ll.insertdata (); } break; case 2: { ll.printdata (); } break; case 3: { ll.deletedata (); } break; } } while (choice != 4); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue