前一个:
#include<stdio.h>
int main()
{char ch;
scanf("%c",&ch);
printf("%c\n",ch);
return 0;
}
后一个:
void del()
//删除学生信息的函数
{FILE *fp;
int n,m=0,flag=0;
char ch;
struct Student *head,*p1,*p2,*current,*front,*p;
if((fp=fopen("student_list.txt","r"))==NULL)
{
printf("cannot open file");
exit(0);
}
printf("Please enter the student's ID:");
scanf("%d",&n);
if(feof(fp))printf("The student's information cannot be find!");
head=NULL;
p1=p2=(struct Student*)malloc(sizeof(struct Student));
while(!feof(fp))
{
fscanf(fp,"%s",p1->name);
fscanf(fp,"%s",p1->sex);
fscanf(fp,"%d",&p1->ID);
fscanf(fp,"%s",p1->academy);
fscanf(fp,"%s",p1->clas);
m++;
if(m==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct Student*)malloc(sizeof(struct Student));
}
p2->next=NULL;
//p2指向链表尾
free(p1);
fclose(fp);
front=NULL;
current=head;
while(current!=NULL&¤t->ID!=n)
{front=current;
current=current->next;
}
if(current!=NULL)
{printf("Are you sure delete the student's informatin?\n");
printf("Please input y or n.\n");
scanf(" %c",&ch);
//要有一个空格
if(ch=='Y'||ch=='y')
flag=1;
else
flag=0;
后一个的代码不完整啊,只有贴了前一部分啊