hello all, i am learning c++ i am new so i can not solve this problem completely. As you know problem is Alphabetical sorter but without vowel letter. I can do it with all letter but i need do it ignore vowel letter. Also The other characters of s follow the lower-case consonants so that their mutual order is not changed.
Ex. The string ebddfff23E is transformed into the string bddfffe23E.
What do you suggest me?
Code:
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void Show(char array[], int size)
{
for (int i = 0; i < size; i++)
std::cout << array[i];
cout << endl;
}
void BSort(char array[], int size)
{
for (int i = 0; i < size-1; i++)
{
if (array[i] > array[i+1])
{
char temp = array[i+1];
array[i+1] = array[i];
array[i] = temp;
i = -1;
}
}
}
int main(int argc, char *argv[])
{
string s;
cin>>s;
int n = s.size();
char mychars[n] ;
for (int i = 0; i < n; i++){
mychars[i] = s.at(i);
}
int size = sizeof(mychars)/sizeof(char);
Show(mychars, size);
BSort(mychars, size);
Show(mychars, size);
system("PAUSE");
return EXIT_SUCCESS;
}