| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 774 人关注过本帖
标题:论坛有人么,能帮我看看怎么保存动态链表的问题吗谢谢
取消只看楼主 加入收藏
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
结帖率:0
收藏
已结贴  问题点数:20 回复次数:7 
论坛有人么,能帮我看看怎么保存动态链表的问题吗谢谢
这是输入函数。



AA *input()
{
    int n;
    AA *r,*s,*h;
    h=(AA *)malloc(LEN);
    r=h;
    if((fp=fopen("teacher_info.dat","w+"))==NULL)
    {
        printf("无法打开教师信息文件");
        return 0;
    }
    printf("教师号:");
    scanf("%d",&n);
    while(n!=0)
    {
        s=(AA *)malloc(LEN);
        s->num=n;
        fflush(stdin);
        printf("姓名:");
        gets(s->name);
        printf("性别:");
        gets(s->gender);
        printf("单位名称:");
        gets(s->work);
        printf("家庭住址:");
        gets(s->address);
        printf("联系电话:");
        gets(s->tel);
        printf("基本工资:");
        scanf("%f",&s->jiben);
        printf("津贴:");
        scanf("%f",&s->jintie);
        printf("生活补贴:");
        scanf("%f",&s->butie);
        printf("电话费:");
        scanf("%f",&s->huafei);
        printf("水电费:");
        scanf("%f",&s->shuidian);
        printf("房租:");
        scanf("%f",&s->fangzu);
        printf("所得税:");
        scanf("%f",&s->shuishou);
        printf("卫生费:");
        scanf("%f",&s->weisheng);
        printf("公积金:");
        scanf("%f",&s->gongji);
        s->yingfa=s->jiben+s->jintie+s->butie;
        s->koukuan=s->huafei+s->shuidian+s->fangzu+s->shuishou+s->weisheng+s->gongji;
        s->shifa=s->yingfa-s->koukuan;
        fprintf(fp,"%d\n%s\n%s\n%s\n%s\n%s\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n",s->num,s->name,s->gender,s->work,s->address,s->tel,s->jiben,s->jintie,s->butie,s->yingfa,s->huafei,s->shuidian,s->fangzu,s->shuishou,s->weisheng,s->gongji,s->koukuan,s->shifa);
        r->next=s;
        r=s;
        printf("num:");
        scanf("%d",&n);
        }
    r->next='\0';
    return h;
    fclose(fp);
}

但我另外写了删除函数

void delete_info(AA *h)
{
   
int x;
AA *p,*q;

printf("输入删除的教师号:");
scanf("%d",&x);
p=h;
q=h->next;
    while(q!='\0'&&q->num!=x)
    {
        p=q;q=q->next;
    }
    if(q->num==x)
    {p->next=q->next;
    printf("已删除该教师信息\n按任意键返回");
    getch();
     }
    else
    printf("没有此教师号");
}



那么文件里面的数据是不变的,请教下怎么另外写一个单独的动态链表保存文件函数,谢谢了!用fwrite和动态链表的结合,还不会,小白求助
搜索更多相关主题的帖子: 教师 return 动态 
2012-06-25 14:35
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
收藏
得分:0 
急,下午有大神能帮我解决的话很感谢
看不懂我可以一直解释
2012-06-25 14:36
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
收藏
得分:0 

void save(AA *h)
{
   
 AA *p;
 char filename[10];
 printf("请输入要创建的文件名以及路径(C:\\stu.list):\n");
 scanf("%s",filename);
 if((fp=fopen(filename,"wb"))==NULL)
 {
  printf("\n无法打开文件");
  return;
 }
 printf("\n正在保存文件,请稍后...");
 p=h;
while(p!=NULL)
 {
 fwrite(p,LEN,1,fp);
 p=p->next;
}
fclose(fp);
printf("保存成功!\n");
}


我写了这么一个保存函数 ,但是文件输出是乱码!
2012-06-25 14:40
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
收藏
得分:0 
回复 4楼 embed_xuel
谢谢啊,懂了一些,我改了下用fprintf;要好些了但是还是有问题
能看看么谢谢
AA save(AA *h)
{
    AA *s;
   
    s=h->next;
    if(s=='\0')
    {
        printf("no info\n");
        getch();
        exit(1);
    }
    else
    {
    if((fp=fopen("teacher_info","wb"))==NULL)
 {
  printf("\n无法打开文件");
  exit (1) ;
 }
     { fprintf(fp,"%d\n%s\n%s\n%s\n%s\n%s\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n",s->num,s->name,s->gender,s->work,s->address,s->tel,s->jiben,s->jintie,s->butie,s->yingfa,s->huafei,s->shuidian,s->fangzu,s->shuishou,s->weisheng,s->gongji,s->koukuan,s->shifa);
 
 
 
    s=s->next;   
    }while(s!='\0');
    printf("\n 保存成功,输入任意键返回\n");
    getch();
    }
}
2012-06-25 14:55
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
收藏
得分:0 
回复 4楼 embed_xuel
就这样吧 不麻烦了 没什么大问题了 谢谢!很感谢!
2012-06-25 14:59
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
收藏
得分:0 
回复 4楼 embed_xuel
等会我贴上完整的,能给我指出些问题的话很感谢啊
2012-06-25 14:59
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
收藏
得分:0 
还是有问题,我再看看

#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#define LEN sizeof(struct teacher)
/*         定义结构体           */
struct teacher
{
    int num;
    char name[10];
    char gender[8];
    char work[100];
    char address[100];
    char tel[10];
    float jiben;
    float jintie;
    float butie;
    float yingfa;
    float huafei;
    float shuidian;
    float fangzu;
    float shuishou;
    float weisheng;
    float gongji;
    float koukuan;
    float shifa;
    struct teacher *next;
};
typedef struct teacher AA;
FILE *fp;



AA save(AA *h)
{
    AA *s;
   
    s=h->next;
    if(s=='\0')
    {
        printf("no info\n");
        getch();
        exit(1);
    }
    else
    {
    if((fp=fopen("teacher_info.txt","wb"))==NULL)
 {
  printf("\n无法打开文件");
  exit (1) ;
 }
     { fprintf(fp,"%d\t%s\n%s\t%s%s\t%.1f\t%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n%.1f\n",s->num,s->name,s->gender,s->work,s->address,s->tel,s->jiben,s->jintie,s->butie,s->yingfa,s->huafei,s->shuidian,s->fangzu,s->shuishou,s->weisheng,s->gongji,s->koukuan,s->shifa);
        s=s->next;   
    }while(s!='\0');
    printf("\n 保存成功,输入任意键返回\n");
    getch();
    }
}
//***************************************************************************************************
//***************************************************************************************************
/*  WELCOME               */
void welcome()
{
    printf("---------------------------------------\n\n");
    printf("c语言课程设计\n\n\n");
    printf("教师工资管理系统\n\n\n");
    printf("学生:巫家竞\t 2011级电气1103班 \n\n");
    printf("---------------------------------------\n\n");
    getch();

}

//***************************************************************************************************
//***************************************************************************************************
/*       菜单             */
void menu()
{
printf("教师工资管理系统\n");
printf("1.输入教师信息\n");
printf("2.修改教师信息\n");
printf("3.删除教师信息\n");
printf("4.浏览教师信息\n");
printf("5.退出\n");
printf("请选择:\n");

}

//***************************************************************************************
//***************************************************************************************
/*       输入函数             */
AA *input()
{
    int n;
    AA *r,*s,*h;
    h=(AA *)malloc(LEN);
    r=h;
    printf("教师号:");
    scanf("%d",&n);
    while(n!=0)
    {
        s=(AA *)malloc(LEN);
        s->num=n;
        fflush(stdin);
        printf("姓名:");
        gets(s->name);
        printf("性别:");
        gets(s->gender);
        printf("单位名称:");
        gets(s->work);
        printf("家庭住址:");
        gets(s->address);
        printf("联系电话:");
        gets(s->tel);
        printf("基本工资:");
        scanf("%f",&s->jiben);
        printf("津贴:");
        scanf("%f",&s->jintie);
        printf("生活补贴:");
        scanf("%f",&s->butie);
        printf("电话费:");
        scanf("%f",&s->huafei);
        printf("水电费:");
        scanf("%f",&s->shuidian);
        printf("房租:");
        scanf("%f",&s->fangzu);
        printf("所得税:");
        scanf("%f",&s->shuishou);
        printf("卫生费:");
        scanf("%f",&s->weisheng);
        printf("公积金:");
        scanf("%f",&s->gongji);
        s->yingfa=s->jiben+s->jintie+s->butie;
        s->koukuan=s->huafei+s->shuidian+s->fangzu+s->shuishou+s->weisheng+s->gongji;
        s->shifa=s->yingfa-s->koukuan;
        r->next=s;
        r=s;
        printf("num:");
        scanf("%d",&n);
        }
    r->next='\0';
    return h;
}

//***************************************************************************************
//***************************************************************************************
/*                   修改函数                    */
void modify(AA *h)
{
int x,n;
AA *p,*q,*r,*s;
printf("输入要修改的教师号:");
scanf("%d",&x);
p=h;
q=h->next;
    while(q!='\0'&&q->num!=x)
    {
        p=q;q=q->next;
    }
    if(q->num==x)
    {printf("该教师信息为:\n");
     printf("教师号:%5d\t\t",q->num);
     printf("教师姓名:%-10s\n",q->name);
      printf("教师性别:%-6s\t\t",q->gender);
     printf("单位名称:%-10s\n",q->work);
     printf("家庭地址:%-10s\t",q->address);
     printf("电话号码:%8s\n",q->tel);
     printf("基本工资:%5.0f\t\t",q->jiben);
     printf("津贴:%5.0f\n",q->jintie);
     printf("生活补贴:%5.0f\t",q->butie);
     printf("\t电话费:%5.0f\n",q->huafei);
     printf("个人所得税:%5.0f\t",q->shuishou);
     printf("卫生费:%5.0f\n",q->weisheng);
     printf("水电费:%5.0f\t\t",q->shuidian);
     printf("房租:%5.0f\n",q->fangzu);
     printf("公积金:%5.0f\t\t",q->gongji);
     printf("应发工资:%5.0f\n",q->yingfa);
     printf("合计扣款:%5.0f\t\t",q->koukuan);
     printf("实发工资:%5.0f\n\n\n",q->shifa);
     printf("确认修改请按\"y\",取消请按\"n\"\n");
     n=getch();
     }
    else
    {printf("没有此教师号");
    exit (1); }
    if(n=='n')
    getch();
    if(n=='y')
    {
        fflush(stdin);
        printf("姓名:");
        gets(q->name);
        printf("性别:");
        gets(q->gender);
        printf("单位名称:");
        gets(q->work);
        printf("家庭住址:");
        gets(q->address);
        printf("联系电话:");
        gets(q->tel);
        printf("基本工资:");
        scanf("%f",&q->jiben);
        printf("津贴:");
        scanf("%f",&q->jintie);
        printf("生活补贴:");
        scanf("%f",&q->butie);
        printf("电话费:");
        scanf("%f",&q->huafei);
        printf("水电费:");
        scanf("%f",&q->shuidian);
        printf("房租:");
        scanf("%f",&q->fangzu);
        printf("所得税:");
        scanf("%f",&q->shuishou);
        printf("卫生费:");
        scanf("%f",&q->weisheng);
        printf("公积金:");
        scanf("%f",&q->gongji);
        q->yingfa=q->jiben+q->jintie+q->butie;
        q->koukuan=q->huafei+q->shuidian+q->fangzu+q->shuishou+q->weisheng+q->gongji;
        q->shifa=q->yingfa-q->koukuan;
    }
}
//***************************************************************************************
//***************************************************************************************

/*       浏览             */
AA display(AA *h)
{
    AA *p;
    p=h->next;
    if(p=='\0')
    {
        printf("no info\n");
        getch();
        menu();
    }
    else
    {
    do{

printf("教师号:%5d\t\t",p->num);
printf("教师姓名:%-10s\n",p->name);
printf("教师性别:%-6s\t\t",p->gender);
printf("单位名称:%-10s\n",p->work);
printf("家庭地址:%-10s\t",p->address);
printf("电话号码:%8s\n",p->tel);
printf("基本工资:%5.0f\t\t",p->jiben);
printf("津贴:%5.0f\n",p->jintie);
printf("生活补贴:%5.0f\t",p->butie);
printf("\t电话费:%5.0f\n",p->huafei);
printf("个人所得税:%5.0f\t",p->shuishou);
printf("卫生费:%5.0f\n",p->weisheng);
printf("水电费:%5.0f\t\t",p->shuidian);
printf("房租:%5.0f\n",p->fangzu);
printf("公积金:%5.0f\t\t",p->gongji);
printf("应发工资:%5.0f\n",p->yingfa);
printf("合计扣款:%5.0f\t\t",p->koukuan);
printf("实发工资:%5.0f\n\n\n",p->shifa);
    p=p->next;   
    }while(p!='\0');
    printf("\n 输入任意键返回\n");
    getch();
    }
}
/*         删除函数           */
void delete_info(AA *h)
{
   
int x;
AA *p,*q;

printf("输入删除的教师号:");
scanf("%d",&x);
p=h;
q=h->next;
    while(q!='\0'&&q->num!=x)
    {
        p=q;q=q->next;
    }
    if(q->num==x)
    {p->next=q->next;
    printf("已删除该教师信息\n按任意键返回");
    getch();
     }
    else
    printf("没有此教师号");
}
//***************************************************************************************
//***************************************************************************************
/*       主函数               */
main()
{
    int choice;
    AA *h;
    welcome();
    while(1)
    {
    menu();
   
    scanf("%d",&choice);
    switch(choice)
    {
        case 1:h=input();break;
        case 2:modify(h);break;
        case 3:delete_info(h);break;
        case 4:display(h);break;
        case 5:save(h);break;
        case 6:exit(1);break;
        default:printf("重新输入\n\n");getch();break;
    }
    }
}
2012-06-25 15:13
强壮的鬼
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-6-25
收藏
得分:0 
回复 9楼 菜鸟0
这。。。。。。谢谢同学。。世界真小。。
这是我现在修改后的,问题是输入没有的教师号之后程序报错,能帮我看看么。。。


#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#define LEN sizeof(struct teacher)
/*         定义结构体           */
struct teacher
{
    int num;
    char name[10];
    char gender[8];
    char work[100];
    char address[100];
    char tel[10];
    float jiben;
    float jintie;
    float butie;
    float yingfa;
    float huafei;
    float shuidian;
    float fangzu;
    float shuishou;
    float weisheng;
    float gongji;
    float koukuan;
    float shifa;
    struct teacher *next;
};
typedef struct teacher AA;
FILE *fp;

//***************************************************************************************************
//***************************************************************************************************
/*  WELCOME               */
void welcome()
{
    printf("---------------------------------------\n\n");
    printf("\t2012年大一c语言课程设计\n\n\n");
    printf("\t教师工资管理系统\n\n\n");
    printf("学生:巫家竞\t 2011级电气1103班 \n\n");
    printf("---------------------------------------\n\n");
    getch();
}

//***************************************************************************************************
//***************************************************************************************************
/*       菜单             */
void menu()
{
printf("教师工资管理系统\n");
printf("1.输入教师信息\n");
printf("2.修改教师信息\n");
printf("3.删除教师信息\n");
printf("4.浏览教师信息\n");
printf("5.保存数据\n");
printf("6.退出\n");
printf("请选择:\n");
}

//***************************************************************************************
//***************************************************************************************
/*       输入函数             */
AA *input()
{
    int n;
    AA *r,*s,*h;
    h=(AA *)malloc(LEN);
    r=h;
    printf("请输入教师号:");
    scanf("%d",&n);
    while(n!=0)
    {
        s=(AA *)malloc(LEN);
        s->num=n;
        fflush(stdin);
        printf("姓名:");
        gets(s->name);
        printf("性别:");
        gets(s->gender);
        printf("单位名称:");
        gets(s->work);
        printf("家庭住址:");
        gets(s->address);
        printf("联系电话:");
        gets(s->tel);
        printf("基本工资:");
        scanf("%f",&s->jiben);
        printf("津贴:");
        scanf("%f",&s->jintie);
        printf("生活补贴:");
        scanf("%f",&s->butie);
        printf("电话费:");
        scanf("%f",&s->huafei);
        printf("水电费:");
        scanf("%f",&s->shuidian);
        printf("房租:");
        scanf("%f",&s->fangzu);
        printf("所得税:");
        scanf("%f",&s->shuishou);
        printf("卫生费:");
        scanf("%f",&s->weisheng);
        printf("公积金:");
        scanf("%f",&s->gongji);
        s->yingfa=s->jiben+s->jintie+s->butie;
        s->koukuan=s->huafei+s->shuidian+s->fangzu+s->shuishou+s->weisheng+s->gongji;
        s->shifa=s->yingfa-s->koukuan;
        r->next=s;
        r=s;
        printf("请输入下一个教师号:(按0取消输入)");
        scanf("%d",&n);
        }
    r->next='\0';
    return h;
}

//***************************************************************************************
//***************************************************************************************
/*                   修改函数                    */
void modify(AA *h)
{
int x,n;
AA *p,*q;
printf("输入要修改的教师号:");
scanf("%d",&x);
p=h;
q=h->next;
    while(q!='\0'&&q->num!=x)
    {
        p=q;q=q->next;
    }
    if(q->num==x)
    {printf("该教师信息为:\n");
     printf("教师号:%5d\t\t",q->num);
     printf("教师姓名:%-10s\n",q->name);
      printf("教师性别:%-6s\t\t",q->gender);
     printf("单位名称:%-10s\n",q->work);
     printf("家庭地址:%-10s\t",q->address);
     printf("电话号码:%8s\n",q->tel);
     printf("基本工资:%5.0f\t\t",q->jiben);
     printf("津贴:%5.0f\n",q->jintie);
     printf("生活补贴:%5.0f\t",q->butie);
     printf("\t电话费:%5.0f\n",q->huafei);
     printf("个人所得税:%5.0f\t",q->shuishou);
     printf("卫生费:%5.0f\n",q->weisheng);
     printf("水电费:%5.0f\t\t",q->shuidian);
     printf("房租:%5.0f\n",q->fangzu);
     printf("公积金:%5.0f\t\t",q->gongji);
     printf("应发工资:%5.0f\n",q->yingfa);
     printf("合计扣款:%5.0f\t\t",q->koukuan);
     printf("实发工资:%5.0f\n\n\n",q->shifa);
     printf("确认修改请按\"y\",取消请按\"n\"\n");
     n=getch();
     }
    if(n=='n'||n=='N')
    menu();
    if(n=='y'||n=='Y')
    {
        fflush(stdin);
        printf("请输入新的教师姓名:");
        gets(q->name);
        printf("性别:");
        gets(q->gender);
        printf("单位名称:");
        gets(q->work);
        printf("家庭住址:");
        gets(q->address);
        printf("联系电话:");
        gets(q->tel);
        printf("基本工资:");
        scanf("%f",&q->jiben);
        printf("津贴:");
        scanf("%f",&q->jintie);
        printf("生活补贴:");
        scanf("%f",&q->butie);
        printf("电话费:");
        scanf("%f",&q->huafei);
        printf("水电费:");
        scanf("%f",&q->shuidian);
        printf("房租:");
        scanf("%f",&q->fangzu);
        printf("所得税:");
        scanf("%f",&q->shuishou);
        printf("卫生费:");
        scanf("%f",&q->weisheng);
        printf("公积金:");
        scanf("%f",&q->gongji);
        q->yingfa=q->jiben+q->jintie+q->butie;
        q->koukuan=q->huafei+q->shuidian+q->fangzu+q->shuishou+q->weisheng+q->gongji;
        q->shifa=q->yingfa-q->koukuan;
    }
    printf("修改完毕,按任意键返回");
    getch();
}
//***************************************************************************************
//***************************************************************************************
/*       浏览             */
void display(AA *h)
{
    AA *p;
    p=h->next;
    if(p=='\0')
    {
        printf("没有教师信息,按任意键继续\n");
        getch();
    }
    else
    {
    do{
printf("教师号:%5d\t\t",p->num);
printf("教师姓名:%-10s\n",p->name);
printf("教师性别:%-6s\t\t",p->gender);
printf("单位名称:%-10s\n",p->work);
printf("家庭地址:%-10s\t",p->address);
printf("电话号码:%8s\n",p->tel);
printf("基本工资:%5.0f\t\t",p->jiben);
printf("津贴:%5.0f\n",p->jintie);
printf("生活补贴:%5.0f\t",p->butie);
printf("\t电话费:%5.0f\n",p->huafei);
printf("个人所得税:%5.0f\t",p->shuishou);
printf("卫生费:%5.0f\n",p->weisheng);
printf("水电费:%5.0f\t\t",p->shuidian);
printf("房租:%5.0f\n",p->fangzu);
printf("公积金:%5.0f\t\t",p->gongji);
printf("应发工资:%5.0f\n",p->yingfa);
printf("合计扣款:%5.0f\t\t",p->koukuan);
printf("实发工资:%5.0f\n\n\n",p->shifa);
    p=p->next;   
    }while(p!='\0');
    printf("\n 输入任意键返回\n");
    getch();
    }
}
//***************************************************************************************
//***************************************************************************************
/*         删除函数           */
void delete_info(AA *h)
{
int x;
AA *p,*q;
printf("输入删除的教师号:");
scanf("%d",&x);
p=h;
q=h->next;
    while(q!='\0'&&q->num!=x)
    {
        p=q;q=q->next;
    }
    if(q->num==x)
    {p->next=q->next;
    printf("已删除该教师信息\n按任意键返回");
    getch();
     }
    else
    {
     printf("没有此教师号\n按任意键返回");
     getch();
    }
}

//***************************************************************************************************
//***************************************************************************************************
/*              保存函数              */
AA save(AA *p)
{
    if((fp=fopen("teacher_info.txt","w"))==NULL)
     {
      printf("\n无法打开文件");
      exit (1);
     }
     p=p->next;
     while(p!='\0')
     {  
         fprintf(fp,"教师号:%d\t\t",p->num);
        fprintf(fp,"姓名:%s\n",p->name);
        fprintf(fp,"性别:%s\t\t",p->gender);
        fprintf(fp,"工作单位:%s\n",p->work);
        fprintf(fp,"地址:%s\t\t",p->address);
        fprintf(fp,"电话号码:%s\n",p->tel);
        fprintf(fp,"基本工资:%.1f\t\t",p->jiben);
        fprintf(fp,"津贴:%.1f\n",p->jintie);
        fprintf(fp,"补贴:%.1f\t\t",p->butie);
        fprintf(fp,"应发工资:%.1f\n",p->yingfa);
        fprintf(fp,"话费:%.1f\t\t",p->huafei);
        fprintf(fp,"水电费:%.1f\n",p->shuidian);
        fprintf(fp,"房租:%.1f\t\t",p->fangzu);
        fprintf(fp,"税收:%.1f\n",p->shuishou);
         fprintf(fp,"公积金:%.1f\t\t",p->gongji);
         fprintf(fp,"卫生费:%.1f\n",p->weisheng);
          fprintf(fp,"合计扣款:%.1f\t\t",p->koukuan);
         fprintf(fp,"实发工资:%.1f\n\n",p->shifa);
        p=p->next;   
    };
    printf("\n 保存成功,输入任意键返回\n");
    getch();
}
//***************************************************************************************
//***************************************************************************************
/*       主函数               */
main()
{
    int choice;
    AA *h;
    h->next='\0';
    welcome();
    while(1)
    {
    system("CLS");
    menu();
    scanf("%d",&choice);
    switch(choice)
        {
        case 1:h=input();break;
        case 2:modify(h);break;
        case 3:delete_info(h);break;
        case 4:display(h);break;
        case 5:save(h);break;
        case 6:exit(1);break;
        default:printf("请输入数字1-6,按任意键重新输入\n\n");getch();break;
        }
    }
}
2012-06-26 22:35
快速回复:论坛有人么,能帮我看看怎么保存动态链表的问题吗谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017924 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved