solutions25 - Part 2 // Sort the list selection(list,...

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 &lt;&lt; &quot;List with duplicates removed:&quot; &lt;&lt; endl; cout &lt;&lt; &quot;\t&quot; &lt;&lt; list[0] &lt;&lt; endl; prev = list[0]; for (k=1; k&lt;size; k++) { if (list[k] != prev) { cout &lt;&lt; &quot;\t&quot; &lt;&lt; list[k] &lt;&lt; endl; } prev = list[k]; }...
View Full Document

Ask a homework question - tutors are online