online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <vector> using namespace std; vector<int> convert(int x) { vector<int> ret; do { ret.push_back(x & 1); }while(x>>=1); reverse(ret.begin(),ret.end()); return ret; } auto print = [] (auto const& v) { for(const auto& e : v) { cout << e << " "; } cout << endl; }; template <typename T> int printStd(T& v) { for (auto i = v.begin(); i != v.end(); i++) { cout << *i << " "; } cout << endl; return 0; } int main() { int x = 98; vector<int> y = convert(x); print(y); // Method 1 - Lambda printStd(y); // Method 2 - user defined function 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