online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include<vector> #include<algorithm> using namespace std; bool MyComp(pair<int,int> a, pair<int,int> b) { if(a.first>=b.first) return true; return false; } int main() { vector<int> vMetric={5,6,1,4,10}; vector<pair<int,int>> vMetricWithIndex; for(int i=0;i<vMetric.size();++i) vMetricWithIndex.push_back({vMetric[i],i}); sort(vMetricWithIndex.begin(),vMetricWithIndex.end(),MyComp); for(auto i:vMetricWithIndex) { cout<<"Element :"<<i.first<<" | Index:"<<i.second<<endl; } 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