JakubKaczmarek_123

zadanie 8

Nov 2nd, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. float tab[3];
  5. int main()
  6. {
  7.   for (int i = 0; i < 3; i++){
  8.     cout << "wprowadz " << i+1 << " liczbe: " << endl;
  9.     cin >> tab[i];
  10.   }
  11.   for (int j = 0; j < 2; j++){
  12.     for (int i = 0; i < 2; i++){
  13.     if (tab[i] > tab[i+1]){
  14.         float x = tab[i];
  15.         tab[i] = tab[i+1];
  16.         tab[i+1] = x;
  17.     }
  18.   }
  19.   }
  20.  
  21.   cout << endl;
  22.     cout << "liczby w poprawnej kolejnosci to: " << endl;
  23.   for (int i = 0; i < 3; i++){
  24.     cout << tab[i] << endl;
  25.   }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment