fork download
  1. #include<iostream>
  2. #include<cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.  
  8. int a[5]={1,8,7,6,8};
  9.  
  10. int i,j;
  11.  
  12. int tmp=0;
  13.  
  14. for(i=0;i<5;i++){
  15. for(j=0;j<5;j++){
  16. if(i==j)
  17. break;
  18. if(a[i]>=a[j])
  19. tmp++;
  20. if(tmp==4)
  21. cout<<"i="<<i<<endl;
  22. }
  23. }
  24.  
  25. return 0;
  26.  
  27. }
  28.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
i=4