sorting any char array..danagram..

#include<iostream>
using namespace std;

main()
{
char a[30];
cout<<“\n enter the char string :”;
cin>>a;
int i=0,count=0;
while(a[i]!=”)
{ count++; i++; }
for(int j=0;j<count;j++)
{ for(i=0;i<count;i++)
if((int)a[i]>(int)a[i+1])
{ int temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
for(i=0;i<count;i++)
cout<<a[i];
cout<<endl<<endl;
system(“pause”);
}

Advertisements

One Response to “sorting any char array..danagram..”

  1. sakshi Says:

    can any one answer to the questions asked by sapient

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: