online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <ostream> #include <bits/stdc++.h> using namespace std; void printHelper(ostream& os,stack<int>& s){ if(s.empty()) return ; int val = s.top(); s.pop(); printHelper(os, s); os << val << " "; s.push(val); } ostream& operator<<(ostream& os,stack<int>& s){ os << "[ "; printHelper(os,s); os << "]\n"; return os; } int main(){ #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif stack<int> s; for(int i = 0;i<5;i++){ s.push(i+1); } cout << s; 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