Sorting arrays

Hello, I'm writing a program that i need to sort out the different lengths of the list of words in my array. I'm not sure where to even begin. I think I need to use the bouble sorting technique but I'm not sure. Anyone know what I am trying to do? This is my code so far. I just need some help getting started on sorting it out so it will look something like this.

Length 1 words:2
length 2 words:3
Length 3 words:5

#include <iostream>
#include <string>
using namespace std;

int main()
{
const int SIZE = 100;
string words[SIZE];
int i, length1=1;

for (i = 0 ; i < SIZE; i++)
{
cout<<"Enter a list of words: Enter the word END to end your list. "<<endl;
cin >> words[i];
if (words[i] == "END")
break;
}
cout<<" "<<endl;
cout<<"Words entered were: "<< endl;

for (int j = 0; j < i; j++)
{
cout << words[j] << ", ";
if(words[j]==words[j].size(1))
}
return 0;
}
1
2
3
4
5
6
7
8
#include <algorithm>

int main()
{
    int MyArr[] = {2,4,3,5,6,1,7,9,8,0};
    std::sort(MyArr, MyArr+10);
    //the array is sorted :)
}


I sure hope your assignment doesn't require you to write the sorting algorithm yourself...
Topic archived. No new replies allowed.