Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //for cin >> and cout <<
- #include <string>
- #include <iomanip>
- #include <Windows.h>
- using namespace std;
- int main(){
- void swap(int&, int&);
- int x;
- int y;
- cout << "Enter values to be sorted: ";
- cin >> x >> y;
- /*
- cout << "Values before sorting:" ;
- */
- if (x > y)
- swap(x, y);
- cout << "Values in ascending order: " << x <<", "<< y <<"\n";
- system("pause");
- return(0);
- }
- void swap (int& a, int& b)
- {
- while (a > b)
- {
- int temp;
- temp = a;
- a = b;
- b = temp;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement