#include <iostream>
using namespace std;
void swap(double* a, double* b) {
double temp = *a;
*a = *b;
*b = temp;
}
void sort2(double* p, double* q) {
if (*p > *q) {
swap(p, q);
}
}
int main() {
double x = 10.5;
double y = 5.5;
cout << "Before sorting: x = " << x << ", y = " << y << endl;
sort2(&x, &y);
cout << "After sorting: x = " << x << ", y = " << y << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: