#include<iostream.h>
#include<conio.h>
#include<string.h>
void sortstring(char *,int n);
void main()
{
int n,i,j;
char a[10][10];
clrscr();
cout<<"\nenter the no. of names to be sorted";
cin>>n;
cout<<"\nenter the names in the list";
for(i=0;i<n;i++)
cin>>a[i];
sortstring(a,n);
cout<<"\nthe sorted strings are=";
for(i=0;i<n;i++)
cout<<a[i];
getch();
}
void sortstring(char a[10][10],int n)
{
int i,j;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(strcmp(a[i],a[j])>0)
{
strcpy(b,a[i]);
strcpy(a[i],a[j]);
strcpy(a[j],b);
}
}
}
}