数据类型添加,未完成

#include <stdio.h>

#include <stdlib.h>

typedef struct node

{

        char szAvpValue[100];

        struct node *next;

}TAvp;

typedef struct

{

        TAvp *head;

        TAvp *tail;      

}TAvpList;

//带头结点的链表

void initAvpList(TAvpList *tHead)

{

     tHead = (TAvpList *)malloc(sizeof(TAvpList));

     tHead->head = tHead->tail = NULL;

}

int selectinput()

{

    int nSelect = 0;

Label:

    system("cls");

    printf("请选择数据类型 ");

    printf("1、字符型 ");

    printf("2、整型 ");

    printf("3、浮点型");

    printf("4、长整形 ");

    printf("5、字符串 ");

    printf("选择选项 (1 - 4) : ");

    scanf("%d",&nSelect);

    if(nSelect < 1 || nSelect > 5)

    {

         printf("选择错误,请重新选择 . ");

         goto Label;

    }

    return nSelect;

}

void InputChar(char *szValue)

{

}

void InputInterger(char *szValue)

{

}

void InputFloat(char *szValue)

{

}

void InputLong(char *szValue)

{

}

void InputString(char *szValue)

{

}

void InputValue(TAvp *tAvp)

{

     printf("录入数据 .... ");

     switch(selectinput())

     {

     case 1:

          /*

          将一个字符型 赋值 给 字符串

          */

          break;           

     case 2:

          /*

          将一个整型 赋值 给 字符串

          */

          break;

     case 3:

          /*

          将一个浮点型 赋值 给 字符串

          */

          break;

     case 4:

          /*

          将一个长整型  赋值 给 字符串

          */

          break;

     case 5:

          /*

          将一个字符串 赋值 给 字符串

          */

          break;

     }

}

//增

void addAvp(TAvpList *tHead)

{

     /*添加 avp 节点*/

     TAvp *tAvp = NULL;

     tAvp = (TAvp *)malloc(sizeof(TAvp));

     tAvp->next = NULL;

     InputValue(tAvp);

}

//删

void deleteAvp(TAvpList *tHead)

{

}

//改

void modifyAvp(TAvpList *tHead)

{

}

//查

void searchAvp(TAvpList *tHead)

{

}

void displayAvpList(TAvpList *tHead)

{

}

int selectAvpList(TAvpList *tHead)

{

   

    int nSelect = 0;

Label:

    system("cls");

    printf("1、添加 avp 节点 ");

    printf("2、删除 avp 节点 ");

    printf("3、修改 avp 节点 ");

    printf("4、查找 avp 节点 "); 

    printf("5、打印 avplist 链表 ");

    printf("0、退出整个程序 ");

    printf("选择 (0 - 5) 操作 : ");

    scanf("%d",&nSelect);

    if(nSelect < 0 || nSelect > 5){

          printf("选择错误 , 请重新选择 ! ");    

          goto Label;

    }

    return nSelect;

}

void menuAvpList(TAvpList *tHead)

{

     int nSelect = 1;

     while(nSelect)

     {

           switch(selectAvpList(tHead))

           {

           case 1:

                //增加 avp 节点

                addAvp(tHead);

                break;

           case 2:

                //删除 avp 节点

                deleteAvp(tHead);

                break;

           case 3:

                //修改 avp 节点

                modifyAvp(tHead);

                break;

           case 4:

                //查找 avp 节点

                searchAvp(tHead);

                break;

           case 5:

                //打印 avplist 链表

                displayAvpList(tHead);

                break;

           case 0:

                nSelect = 0;

                break;

           }

     }

}

int main()

{

     TAvpList *tHead;

     initAvpList(tHead);

     menuAvpList(tHead);

     return 0;

}

原文地址:https://www.cnblogs.com/boobuy/p/3402388.html