online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector> bool less(int lhs, int rhs) { static const int cmp[] = { 0, 2, 1, 3 }; return cmp[lhs] < cmp[rhs]; } int main() { int size; std::srand(time(nullptr)); if (!(std::cin >> size)) return 1; std::vector<int> array(size); for (auto &a : array) a = rand() % 3 + 1; std::sort(array.begin(), array.end(), less); for (const auto &a : array) { std::cout << a << '\n'; } }

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