Hi all.
I've got this code here
which aparantly can sort text. I need to customize this code to do the following - search through some text, sort all of the numbers, and arange them in numerical order, break up all the letters, and sort them alphabetically ( capitals first), then arange all the punctuation in a specific order, so if it takes a text like this:Code:#include <iostream.h> #include <string.h> #include <conio.h> //jumbled up text in array char strarray[] = "fgjhsflsdlkfghdksdkjdgskakdkfkjggkdkgjg"; int i = 0; int j = 0; char temp; void Bubble(char* strarray, int arrsize); int main() { cout << strarray << endl; Bubble(strarray, strlen(strarray)); cout << strarray << endl; return 0; } void Bubble(char* strarray, int arrsize) //Bubble Sort code { for(i=0; i< (arrsize - 1); ++i) { for(j = i + 1; j > 0; --j) { if(strarray[j] < strarray[j-1]) { //Swaps the values temp = strarray[j]; strarray[j] = strarray[j - 1]; strarray[j - 1] = temp; } } } }
it will come out something like this:I remember 4/12/1987.
Is that possible with this code? Could someone please point me in the right direction - bearing in mind I am a complete begginer4
12
1987
b
e e e
I
m
m
r
r
.
/ /
thanks a lot



LinkBack URL
About LinkBacks



