Sorting of Vowels and consonants via Linked Lists

Hi Guyz.
I've been given a task to write a program that prompts the user to input a text, and the program calculates the number of vowels & consonants, then sorts the text on a table in ascending order with respect to vowels/consonants (as the user desires). And lastly, print the frequency of each word contained in the text.
Here's how it's required to look like:

Enter Text:
I Love c plus plus.

Original Text analysis.
|words| |Consonants| |Vowels|
I 0 1
Love 2 2
c 1 0
plus 3 1
plus 3 1

Sort words in text:
1) By increasing number of consonants
2) By increasing number of vowels

1

words| |Consonants| |vowels| |Frequency|
I 0 1 1
c 1 0 1
Love 2 2 1
plus 3 1 2
plus 3 1



Please help out guys, i need to submit this on wednesday....i really appreciate for the opportunity. Thanks.

Himsdlee.
Where are you getting stuck?
I'm actually new to lists. Now having problems with passing strings/characters into the list.
and as for the sorting aspect, don't really know how to get around it...
Here's what i've done so far:

#include "iostream"
using namespace std;

struct spisok //(spisok, meaning LIST);
{
string rext;
spisok *end;
};

void enter_Text(spisok *&startPtr, spisok *&current, int j);
void display_Text(spisok *$startPtr);
void sort_Text();

int main()
{
int j=1;
spisok *startPtr=NULL;
spisok *current;
enter_Text(startPtr, current, j);
display_Text(startPtr);
return 0;
}

void enter_Text(spisok *&startPtr, spisok *&current, int j)
{
spisok *temp, *temp2;
for (int i=0; i<j; i++) {
temp= new spisok;
cout<<"Enter Text: "<<endl;
cin>>temp->rext;
// cin.get(temp->rext, j);
temp->end=NULL;
if (startPtr==NULL) {
startPtr=temp;
current=startPtr;
}
else {
temp2=startPtr;
while (temp2->end!=NULL) {
temp2=temp2->end;
temp2->end=temp;
}
}
}
}

void display_Text(spisok *$startPtr)
{
spisok *temp;
temp=$startPtr;
cout<<"Text entered: "<<endl;
while (temp!=NULL) {
cout<<temp->rext<<endl;
temp=temp->end;
}
}


And after running that, here's what it produces:

Enter Text:
I love programming

Text Entered:
I

How do i go about this)
Last edited on
Topic archived. No new replies allowed.