Sort three floating values in descending order

Please help me out with my assignment. I am quite new to programming language and got stuck with this assignment. Here is the assignment:

Write a class named Sort3 containing a mySort() public member method that sorts three floating point values. The mySort() method should sort the three values from largest to smallest (descending order). The class must use references (or pointers) as mySort() has to affect (sort) the three variables entered by the user in the calling program (main).

Hint: mySort() should look at the three numbers as two pairs: sort the first pair, then the second, then the first again if a change was made at the second pair...

Here is a possible class declaration (using references):

class Sort3
{
public:
void mySort(float& first, float& second, float& third)
{
// code to be added...
}
};


This is what i got so far. The problem is that the displaying code is not working right. It won't show the three integers in descending order but show one long weird integer and I don't know how to fix it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
using namespace std;

class Sort3
{
private:
	float& first;
	float& second;
	float& third;

public:

	Sort3(float& a, float& b, float& c) : first(a), second(b), third(c)
	{
	}


	void swap(float& x, float& y)
	{
		float temp;

		temp = x;
		x = y;
		y = temp;
	}

	void mySort(float& first, float& second, float& third)
	{
		if (first < second)
			swap(first, second);
		if (first < third)
			swap(first, third);
		if (second < third)
			swap(second, third);
		return;
	}
};

int main()
{
	float first, second, third;
	cout << "Please enter the first integer: " << endl;
	cin >> first;
	
	cout << "Please enter the second integer: " << endl;
	cin >> second;
	
	cout << "Please enter the third integer: " << endl;
	cin >> third;

	Sort3 obj(first, second, third);

	obj.mySort(first, second, third);

	cout << "The three numbers in descending order: " << endl;
	cout << first << ', ' << second << ', ' << third << endl;

	return 0;
}
@56 those text literals need to be in " " not ' '.
oh it works now, thank you so much!
Topic archived. No new replies allowed.