add.c

来自「大一时课程设计 通信录管理系统 可作为C课程设计的参考」· C语言 代码 · 共 37 行

C
37
字号
#include"yy.h"

NODE *add(NODE *head)
{
    NODE *p0,*p1;
    p1=head;
    p0=(NODE *)malloc(LEN);

    clrscr();
    printf("\n\n\n\tplease input the name:\n\t");
    gets(p0->name);
    printf("\tplease input the phone number:\n\t");
    gets(p0->phone);
    printf("\tplease input the sex:\n\t");
    gets(p0->sex);
    printf("\tplease input the age:\n\t");
    gets(p0->age);
    printf("\tplease input the birthday:\n\t");
    gets(p0->birthday);
    printf("\tplease input the dormitory:\n\t");
    gets(p0->dormitory);


    if(head==NULL)
        {head=p0;p0->next=NULL;n=1;}
    else
        {while(p1->next!=NULL)
         p1=p1->next;
         }
         p1->next=p0;
         p0->next=NULL;
         n++;


    return head;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?