help.. i dont know how to sort strings.. for example..
if i enter:
JOKER
then the descending order of string must appear:
ROKJE
i think of strcpy() ..but it i dont know what to place in the if().. here's my code..
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{
clrscr();
char a[100],temp[100];
cout<<"Enter string: ";
gets(a);
cout<<"\nThe reverse of the string entered is: ";
for(int i=(strlen(a)-1);i>=0;i--)
cout<<a[i];
cout<<"\n\nLETTERS IN THE STRING: ";
for(int b=0;b<=(strlen(a)-1);b++)
{
for(int c=0;c<=(strlen(a)-2);c++)
{
if(strcmp(a[c],a[c+1])<0) //I DON"T THINK THIS IS RIGHT
{
strcpy(temp,a[c]);
strcpy(a[c],a[c+1]);
strcpy(a[c],temp);
}
}
}
getch();
}
how could i implement the strcpy or the strcmp in my code??