online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <bits/stdc++.h> #include <cmath> using namespace std; int leng(int n){ int k=0; while(n){ k+=1; n=n/10; } return k; } int main() { int t; cin >> t; while(t--) { int n; cin >> n; int a[n]; for(int i=0;i<n;i++){ cin >> a[i]; } int len[n]; int max = -1; for(int i=0;i<n;i++){ len[i] = leng(a[i]); if(len[i]>max){ max = len[i]; } } int b[n]; for(int i=0;i<n;i++){ b[i] = a[i]*pow(10,max-leng(a[i])); } for(int i=0;i<n;i++){ //cout<<b[i]<<" "; } long long int jj = 0; for(int i=0;i<n;i++){ int q=-1; int ma = 0; for(int j=0;j<n;j++){ if(b[j]>ma){ ma = b[j]; q = j; } } //cout<<ma<<" "; b[q] = 0; if(jj==0){ jj+=a[q]; //cout<<jj<<"\n"; } else{ jj*=pow(10,len[q]); jj+=a[q]; //cout<<jj<<"\n"; } } cout<<jj<<"\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