#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char x[5][10]={"harish","Harish","HARISH","hARISH","HaRIsh"};
cout<<"Before Sorting ->";
for(int i=0;i<5;i++)
{ gotoxy(20,1+i);
cout<<x[i]; }
char b[10];
for( i=1;i<5;i++)
{
for(int j=0;j<5-i;j++)
{
if((strcmp(x[j],x[j+1]))>0)
{
strcpy(b,x[j+1]);
strcpy(x[j+1],x[j]);
strcpy(x[j],b);
}
}
}
gotoxy(40,1);
cout<<"After Sorting ->";
for( i=0;i<5;i++) /*capital letters ascii code comes before
small letters ascii code */
{ gotoxy(60,1+i);
cout<<x[i]; }
getch();
}
#include<conio.h>
#include<string.h>
void main()
{
char x[5][10]={"harish","Harish","HARISH","hARISH","HaRIsh"};
cout<<"Before Sorting ->";
for(int i=0;i<5;i++)
{ gotoxy(20,1+i);
cout<<x[i]; }
char b[10];
for( i=1;i<5;i++)
{
for(int j=0;j<5-i;j++)
{
if((strcmp(x[j],x[j+1]))>0)
{
strcpy(b,x[j+1]);
strcpy(x[j+1],x[j]);
strcpy(x[j],b);
}
}
}
gotoxy(40,1);
cout<<"After Sorting ->";
for( i=0;i<5;i++) /*capital letters ascii code comes before
small letters ascii code */
{ gotoxy(60,1+i);
cout<<x[i]; }
getch();
}