online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
//https://online.codingblocks.com/app/player/93452/content/153370/5316/code-challenge //https://online.codingblocks.com/app/player/93452/content/153370/5316/code-challenge #include<bits/stdc++.h> using namespace std; typedef long long int ll; bool compareDigits(int a, int b) { string A = to_string(a); string B = to_string(b); int i = 0; while(i < A.size() && i < B.size()) { if(A[i] != B[i]) return (A[i] < B[i]); //if character mismatch found else { i++; } } if(A.size() == B.size()) return (A.size() == B.size()); else { if(A.size() < B.size()) { i = A.size(); return B[i] > B[i-1]; } else { i = B.size(); return A[i] < A[i-1]; } } } class solution { public: void getInput() { int N; cin >> N; vector<int> A; getArray(A, N); sort(A.begin(), A.end(), compareDigits);//sorting in ascending order for(int i = N - 1 ; i >= 0 ; i--)//printing in descending order { cout << A[i]; } cout << endl; } void getArray(vector<int> &A, int N) { for(int i = 0 ; i < N ; i++) { int val; cin >> val; A.push_back(val); } } }; int main() { int t; cin >> t; while(t--) { solution Solution; Solution.getInput(); } 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