efficiency of sorting function
could i write the function more efficiently? void Winners:: sorting() { int temp; char tempstr[30]; if (first_score >= second_score) { temp = second_score; strcpy(tempstr, second_name); second_score = first_score; second_name = new char[strlen(first_name) + 1]; strcpy(second_name, first_name); first_score = temp; first_name = new char[strlen(tempstr) + 1]; strcpy(first_name, tempstr); } if (first_score >= third_score) { temp = first_score; strcpy(tempstr, first_name); first_score = second_score; first_name = new char[strlen(second_name) + 1]; strcpy(first_name, second_name); second_score = temp; second_name = new char[strlen(tempstr) + 1]; strcpy(second_name, tempstr); } else if (second_score <= third_score) { temp = first_score; strcpy(tempstr, first_name); first_score = third_score; first_name = new char[strlen(third_name) + 1]; strcpy(first_name, third_name); third_score = temp; third_name = new char[strlen(tempstr) + 1]; strcpy(third_name, tempstr); } else { temp = second_score; strcpy(tempstr, second_name); second_score = first_score; second_name = new char[strlen(first_name) + 1]; strcpy(second_name, first_name); first_score = temp; first_name = new char[strlen(tempstr) + 1]; strcpy(first_name, tempstr); temp = second_score; strcpy(tempstr, second_name); second_score = third_score; second_name = new char[strlen(third_name) + 1]; strcpy(second_name, third_name); third_score = temp; third_name = new char[strlen(tempstr) + 1]; strcpy(third_name, tempstr); }