#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
typedef struct employees
{
char ID[20];
float salary;
struct employee* next;
}epy;
void PrintT(epy* Head)
{
epy* p;
p = Head;
printf("员工的ID和薪资\n");
while (p)
{
printf("ID:%s\n salary:%f\n", p->ID, p->salary);
p = p->next;
}
}
epy* Delete_T(epy* head, char* id)
{
epy* p = head;
epy* D = NULL;
while (p && strcmp(p->ID, id) != 0)
{
D = p;
p = p->next;
}
if (!p)
{
printf("无对应编号");
}
else
{
if (D == NULL)
{
head = p->next;
}
else
{
D->next = p->next;
}
free(p);
}
return head;
}
epy* CreatT(int n)
{
epy* Head, * cur, * pnew;
int i;
Head = cur = NULL;
for (i = 0; i < n; i++)
{
pnew = (epy*)malloc(sizeof(epy));
printf("请输入第%d个员工的ID和salary\n", i + 1);
scanf("%s%f", &pnew->ID, &pnew->salary);
if (i == 0)
{
Head = cur = pnew;
}
else
{
cur->next = pnew;
cur = pnew;
}
}
cur->next = NULL;
return Head;
}
int main()
{
char ID[20];
epy* head = CreatT(5);
PrintT(head);
printf("\n请输入需要删除的ID:");
scanf_s("%s", ID);
head = Delete_T(head, ID);
PrintT(head);
system("pause");
}

有些粗心了 童鞋
typedef struct employees
{
char ID[20];
float salary;
struct employee* next;
}epy;
struct employee* next;改为
struct employees* next;