Advertisement
RuiViana

AA_C_Sort

Mar 16th, 2021
1,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.     int ordem[] = {28, 35, 62, 998, 47, 32};
  5.   int temp1;
  6.   int i, j, temp2, temp4;
  7.  
  8.   for (i = 0; i <  6 - 1; i++)
  9.   {
  10.     for (j = i + 1; j < 6; j++)
  11.     {
  12.       if (ordem[i] > ordem[j])
  13.       {
  14.         temp1 = ordem[i];
  15.         ordem[i] = ordem[j];
  16.         ordem[j] = temp1;
  17.       }
  18.     }
  19.   }
  20.   for (i = 0; i < 6; i++)
  21.   {
  22.      std::cout << ( ordem[i]);
  23.      std::cout << (" ");
  24.   }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement