#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char *names[] = {
"Sanjukta",
"Arindam",
"Chandan",
"Arnab",
"Shivaji"
};
int i,j,d;
char *t;
clrscr();
for (i=0;i<=4;i++)
printf ("\n%s",names[i]);
for (i=0;i<=3;i++)
{
for (j=i+1;j<=4;j++)
{
d = strcmp(names[i],names[j]);
if (d>0)
{
t = names[i];
names[i] = names[j];
names[j] = t;
}
}
}
printf ("\n\n\n");
for (i=0;i<=4;i++)
printf ("\n%s", names[i]);
getch();
}
#include<conio.h>
#include<string.h>
void main()
{
char *names[] = {
"Sanjukta",
"Arindam",
"Chandan",
"Arnab",
"Shivaji"
};
int i,j,d;
char *t;
clrscr();
for (i=0;i<=4;i++)
printf ("\n%s",names[i]);
for (i=0;i<=3;i++)
{
for (j=i+1;j<=4;j++)
{
d = strcmp(names[i],names[j]);
if (d>0)
{
t = names[i];
names[i] = names[j];
names[j] = t;
}
}
}
printf ("\n\n\n");
for (i=0;i<=4;i++)
printf ("\n%s", names[i]);
getch();
}
0 comments :
Post a Comment