online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #define NCARDS 52 #define MAXITERATIONS 200 namespace c{ struct card{ int value; card* previousCard; card* nextCard; } deck[NCARDS]; void init(card* deck) {for(int i=0;i<NCARDS-1;i++){deck[i].value=i+1;deck[i].nextCard=&deck[i+1];} deck[NCARDS-1].value=NCARDS;deck[NCARDS-1].nextCard=&deck[0]; for(int i=1;i<NCARDS;i++){deck[i].previousCard=&deck[i-1];} deck[0].previousCard=&deck[NCARDS-1]; } void print(card* deck){card* temp=&deck[0];for(int i=0;i<NCARDS;i++){std::cout<<temp->value<<std::endl;temp=temp->nextCard;}} void removeShiftAndSplice(card* deck,int a,int b,int c){ card* temp[2]; card* stemp[2]; stemp[0]=&deck[a]; temp[0]=deck[a].previousCard;temp[1]=stemp[0]; for(int i=0;i<b;i++){temp[1]=temp[1]->nextCard;} stemp[1]=temp[1]; temp[1]=stemp[1]->nextCard; temp[0]->nextCard=temp[1]; temp[1]->previousCard=temp[0]; temp[0]=stemp[0]->previousCard; for(int i=0;i<c;i++){temp[0]=temp[0]->nextCard;} temp[1]=temp[0]->nextCard; temp[0]->nextCard=stemp[0];stemp[0]->previousCard=temp[0]; temp[1]->previousCard=stemp[1];stemp[1]->nextCard=temp[1]; } }//end of namespace int main() { init(c::deck); for(int i=0;i<MAXITERATIONS;i++){ removeShiftAndSplice(c::deck,i%13,i%17,i%23); }; print(c::deck); }

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