Advertisement
alch1337

PosortujTrzy

May 26th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdio>
  3.  
  4. using namespace std;
  5.  
  6. void Posortuj(float& fA, float& fB, float& fC)
  7. {
  8.     if (fA<fB && fA<fC)
  9.     {
  10.         if (fB<fC) cout<<fA<<", "<<fB<<", "<<fC;
  11.         else cout<<fA<<", "<<fC<<", "<<fB;
  12.     }
  13.     else if (fB<fA && fB<fC)
  14.     {
  15.         if (fA<fC) cout<<fB<<", "<<fA<<", "<<fC;
  16.         else cout<<fB<<", "<<fC<<", "<<fA;
  17.     }
  18.     else
  19.     {
  20.         if (fA<fB) cout<<fC<<", "<<fA<<", "<<fB;
  21.         else cout<<fC<<", "<<fB<<", "<<fA;
  22.     }
  23. }
  24.  
  25. int main()
  26. {
  27.     float fA, fB, fC;
  28.  
  29.     cout<<"Podaj trzy liczby, a wypisze je rosnaco!"<<endl;
  30.     cin>>fA>>fB>>fC;
  31.     Posortuj(fA, fB, fC);
  32.  
  33.     getchar();
  34.     cin.ignore();
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement