Online C++ Compiler

#include<bits/stdc++.h> using namespace std; int main(){ char str[3][20]={"Ajay","Ramesh","Mahesh"}; char t[20]; int i, j; for(i=1; i<3; i++){ for(j=1; j<3; j++){ if(strcmp(str[j-1], str[j])>0){ strcpy(t, str[j-1]); strcpy(str[j-1], str[j]); strcpy(str[j], t); } } } cout<<”Sorted in Descending Order ::"; for(i=3; i>=0; i--){ cout<<" "; cout<<str[i]<<"\n"; } return 0; }