Are the names defined as std::strings or char[].
If it is char[] don't forget you need to use strcmp to actually compare them.
If you are using std::string you can overload the > operator.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
RefnumberTemp = Quote[j].RefNumber;
Quote[j].RefNumber = Quote[j+1].RefNumber;
Quote[j+1].RefNumber = RefnumberTemp;
Assuming the above logic works shouldn't it the the below?
strcpy (SurnameTemp, Quote[j].Surname);
strcpy (Quote[j].Surname, Quote[j+1].Surname);
strcpy (Quote[j+1].Surname,SurnameTemp);
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Since structure assignment is supported, just do
temp = Quote[j+1];
Quote[j+1] = Quote[j];
Quote[j] = temp;
where temp is the same type as the struct used for your array.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953