Hi! :)
I want to print all different elements of sorting array.
input: 10 10 5 4
output: 10 5 4
:-/
Thank you!
a_sd 0 Newbie Poster
Recommended Answers
Jump to PostIf this is an assignment for a class then the method you have is probably the right kind of way to go. However, if you're doing it for a project of your own, then you can do this in a couple of lines using STL algorithms:
// …
Jump to PostInput all the numbers
Sort the numbers
Remove the duplicates
Output what's left
All 5 Replies
zeroliken 79 Nearly a Posting Virtuoso
MandrewP 60 Junior Poster in Training
a_sd 0 Newbie Poster
ravenous 266 Posting Pro in Training
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.