请问结构体学过没呢,能不能用链表?
#include
#include
char s[100][20];int i=0;
void Insert()
{
printf("Please input the name:");
scanf("%s",s[i]);
i++;
};
void Delete()
{
printf("Please input the name:");
char s1[20];
scanf("%s",s1);
int j,k,l;
for(j=0;j if(!strcmp(s1,s[j]))
{
for(k=j;k strcpy(s[k],s[k+1]);
printf("Done\n");
i=i-1;
return;
};
printf("Not found\n");
};
void Output()
{
char s1[20];
for(int j=0;j for(int k=j+1;k if(strcmp(s[j],s[k])>0)
{
strcpy(s1,s[j]);
strcpy(s[j],s[k]);
strcpy(s[k],s1);
};
for(j=0;j printf("\n");
};
void main()
{
int c;int t=1;
while (t)
{
printf("1.Insert\n2.Delete\n3.Output\n4.Exit\n");
scanf("%d",&c);
switch(c)
{
case 1:Insert();break;
case 2:Delete();break;
case 3:Output();break;
case 4:t=0;break;
default:printf("Error\n");break;
};
};
}
VC6.0通过