Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <locale>
- #include <iostream>
- using namespace std;
- void swap(int *a, int *b)
- {
- int c;
- c = *a;
- *a = *b;
- *b = c;
- }
- void Sort(int *a, int *b, int *c)
- {
- if (*b > *a) swap(a, b);
- if (*c > *a) swap(a, c);
- if (*c > *b) swap(b, c);
- }
- int main(int argc, char* argv[])
- {
- int a1, a2, a3;
- a1 = 22; a2 = -11; a3 = 11;
- cout << a1 << " " << a2 << " " << a3 << endl;
- Sort(&a1, &a2, &a3);
- cout << a1 << " " << a2 << " " << a3 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment