A program that will ask the user to give six names of the person and ask the user to sort the names by ascending or descending order using a C programming language.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.Please subscribe to my channel https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg
Thank you very much for your support.
Program Listing#include <stdio.h>#include <conio.h>#include <string.h>main(){char name[6][100],temp[100];int a1,i,j,select=0,c=1;printf("\n");printf("\tSorting Person's Name in C");printf("\n");printf("\nGive Six Names : ");printf("\n");for(a1=0;a1<=5;a1++){printf("%d. ",c);gets(name[a1]);c++;}printf("\n");printf("\t[1] Sort in Ascending Order [2] Sort in Descending Order : ");scanf("%d",&select);printf("\n");if (select==1){for(i=0;i<6;i++){for(j=i+1;j<6;j++){if(strcmp(name[i],name[j])>0){strcpy(temp,name[i]);strcpy(name[i],name[j]);strcpy(name[j],temp);}}}printf("\n");printf("\tSorting Names in Ascending Order");c=1;for(i=0;i<5;i++){printf("\n%d. %s",c,name[i]);c++;}}else if(select==2){for(i=0;i<5;i++){for(j=i+1;j<6;j++){if(strcmp(name[i],name[j])<0){strcpy(temp,name[i]);strcpy(name[i],name[j]);strcpy(name[j],temp);}}}printf("\n");printf("\tSorting Name's 'Descending Order");c=1;for(i=0;i<5;i++){printf("\n%d. %s",c,name[i]);c++;}}else if(select<=0|| select>=3){printf("\n\Cannot sort Invalid Key!");}printf("\n");printf("\tEnd of Program");printf("\n");}