It is a cpp program.Sort names by alphabetical order.
Users give some names as input and they will get sorted name by alphabetical order.I think that it may be helpful to others
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
Program to sort the n names in an alphabetical order
1. #include <stdio.h>
#include <string.h>
int main()
{
char name[20][10], tname[20][10], temp[10];
int i, j, n;
printf("Enter the number of Names you want to do input:n"); //how many names input
scanf("%d", &n);
printf("Enter names: n");
for (i = 0; i < n; i++)
{
scanf("%s", name[i]);
strcpy(tname[i], name[i]);
} //input names
for (i = 0; i < n - 1 ; i++)
{
for (j = i + 1; j < n; j++)
{
if (strcmp(name[i], name[j]) > 0)
{ strcpy(temp, name[i]);
strcpy(name[i], name[j]);
strcpy(name[j], temp);
}
}
} //for alphabetically sorting
2. printf("n----------------------------------------n");
printf(" Input || NamestSorted namesn");
printf("------------------------------------------n");
for (i = 0; i < n; i++)
{
printf("%st || t%sn", tname[i], name[i]); //printf storted names
}
printf("------------------------------------------n");
}
By Samsil Arefin
Samsilarefin017@gmail.com