My Professional Profile

I am Johnson Augustine Sr.Software Engineer and System Architect. I have 10 Yrs of hands on expertise in ASP.net MVC 5 , Angular 5 , C# MVC Razor, WPF MVVM , Android , IOS Swift 3 , IOS11 MSSQL,MySQL Database,,PHP,C/C++/Visual C++/G++/QT++,Com,DirectX,Open CV,EMGU CV , embedded System Development , [Raspberry PI]. ,html,Javascript,Jquery,Ajax.CSS , Networking ,Cyber security, Ethical Hacking You can see my professional profile at http://linkedin.com/in/johnsontaugustine Email : johnsonaugustine@live.com

Saturday, 19 January 2013

Sort names using C


#include < stdio.h >
#include < conio.h >
#include < alloc.h >

void main()
{
char *list[100],temp[10];
int n,i,j;
clrscr();
printf("How many names?\n");
scanf("%d",&n);
printf("Enter %d names \n",n);
for(i=0;i < n;i++)
{
list[i]=(char *)malloc(100);
flushall();
gets(list[i]);
}
for(i=0;i < n-1;i++)
{
for(j=i+1;j < n;j++)
{
strcmp(list[i],list[j]);
{
strcpy(temp,list[i]);
strcpy(list[i],list[j]);
strcpy(list[j],temp);
}
}
}
printf("The %d names in sorted order are\n",n);
for(i=0;i < n;i++)
{
puts(list[i]);
}
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.