Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjacobproffer
24,604 PointsSort vector of strings by string length in C++
Hey folks,
I know C++ is currently not one of the topics covered by Treehouse. But I thought I'd take a chance.
I'm currently writing a program to check a document for palindromes. One last functionality that I'd like to implement is to print found palindromes by their size (I.E. aa, bob, malayalam) instead of alphabetically.
At the current time, I'm storing all found palindromes in a vector. The reason I'm using a vector over an array is because I don't have to define the size (The current document that I'm checking has 99,000+ words).
With that being said, would anyone know how to sort a vector of strings by string length in C++?
Any advice is welcome.
Best,
Jacob