fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int a[5]={5,1,4,3,2},b[5]={1,2,3,4,5};
  6. for(int i=0;i<5;i++){
  7. for(int j=0;j<5;j++){
  8. if(a[b[i]]>a[b[j]]){
  9. int temp;
  10. temp=b[i];
  11. b[i]=b[j];
  12. b[j]=temp;
  13. }
  14. }
  15. }
  16. for(int i=0;i<5;i++){
  17. cout<<b[i];
  18. }
  19.  
  20. }
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
52341