online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #define ll long long using namespace std; class node{ public: ll data; node* next; node(ll d) { data = d; next = NULL; } }; void insertattail(node* &head,ll data) { if(head==NULL) { node* n = new node(data); head = n; return; } else { node* temp = head; node* n = new node(data); while(temp->next != NULL) { temp = temp->next; } temp->next = n; return; } } void print(node* head) { while(head != NULL) { cout<<head->data<<" "; head = head->next; } exit(0); } void reverse(node* &head) { node* p = NULL; node* c = head; node* x; while(c!=NULL) { x = c->next; c->next = p; p = c; c = x; } head = p; print(head); } void build(node* &head,ll n) { ll count = 0; ll data; while(count!=n) { cin>>data; insertattail(head,data); count++; } } int main() { ll n1; cin>>n1; node* head1 = NULL; build(head1,n1); ll x; cin>>x; if(x>=n1) { reverse(head1); } node* p = NULL; node* n = head1; int count = 1; while(count<n1-x+1) { p = n; n = n->next; count++; } p->next = NULL; node* temp = n; while(temp->next!=NULL) { temp = temp->next; } temp->next = head1; print(n); 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