Shopping In MUMBAI

Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top. Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.

Tuesday, December 30, 2008

Write a program to read an array of names and sort them in alphabetical order.

Write a program to read an array of names and sort them in alphabetical order.

#include
#include
#include
void main()
{
char str[5][10],t[10];
int i,j;
clrscr();
printf("\nEnter the strings : ");
for(i=0;i<5;i++)
scanf("%s",str[i]);
printf("\nSorted strings are:\n");
for(i=0;i<=4;i++)
{
for(j=i+1;j<5;j++)
{
if(strcmp(str[i],str[j])>0)
{
strcpy(t,str[i]);
strcpy(str[i],str[j]);
strcpy(str[j],t);
}
}
printf("\n%s",str[i]);
}
getch();
}

/*Output
Enter the strings : rose
mango
apple
marigold
banana

Sorted strings are:

apple
banana
mango
marigold
rose*/

Write a program to read an array of names and sort them in alphabetical order.SocialTwist Tell-a-Friend

0 comments:

SUPPORT THIS BLOG