solutions25 - Part 2 Sort the list selection(list size...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1100 Computer Science I Rensselaer Polytechnic Institute Spring 2004 Studio 25 -- Solutions Part 1 In function selection , change the line: if (list[k] < list[minLoc]) { to the following: if (list[k] > list[minLoc]) { In other words, change the < sign to a > sign. You might also want to change the name of variable minLoc to maxLoc and change a few comments.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Part 2 // Sort the list selection(list, size); // Display list with duplicates removed cout << "List with duplicates removed:" << endl; cout << "\t" << list[0] << endl; prev = list[0]; for (k=1; k<size; k++) { if (list[k] != prev) { cout << "\t" << list[k] << endl; } prev = list[k]; }...
View Full Document

Ask a homework question - tutors are online