| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1760 人关注过本帖
标题:关于C语言数据结构的BUG不能求解?
只看楼主 加入收藏
后卿
Rank: 4
来 自:网络
等 级:业余侠客
威 望:1
帖 子:302
专家分:295
注 册:2016-10-22
结帖率:81.71%
收藏
已结贴  问题点数:10 回复次数:3 
关于C语言数据结构的BUG不能求解?
这是我的代码:

//5.插入一条成员记录,使原通讯录保持有序
    void insertYouXu(LinkList L,LinkList Elem)
    {
        LinkList p=L->next;
        while(p!=NULL && Elem->number >= p->number)
        {
            if(p->number==Elem->number)
            {
                printf("重复输入!!\n");
                return;
            }
            p=p->next;
        }
        if(p==NULL)//确定Elem的插入位置
        {
          p=prior(L,p);
          Elem->next=NULL;
          p->next=ELem;
        }
        else
        {
           p=prior(L,p);
           Elem->next=p->next;
           p->next=Elem;
        }
    }
下面是我的编译后生成的信息,新手实在不会改,请指教
\main.c|147|warning: implicit declaration of function 'prior'|
\main.c|147|warning: assignment makes pointer from integer without a cast|
\main.c|149|error: 'ELem' undeclared (first use in this function)|
\main.c|149|error: (Each undeclared identifier is reported only once|
\main.c|149|error: for each function it appears in.)|
\main.c|153|warning: assignment makes pointer from integer without a cast|

搜索更多相关主题的帖子: Elem next NULL number main 
2017-08-11 18:34
jklqwe111
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:35
帖 子:336
专家分:1135
注 册:2014-4-13
收藏
得分:10 
    p->next=ELem;
大小写L--------l
2017-08-11 20:32
后卿
Rank: 4
来 自:网络
等 级:业余侠客
威 望:1
帖 子:302
专家分:295
注 册:2016-10-22
收藏
得分:0 
回复 2楼 jklqwe111
哦哦看到了,那CODEBLOCKS里面 如果编译后 结果为警告,要不要紧,影不影响程序的执行
2017-08-12 19:36
后卿
Rank: 4
来 自:网络
等 级:业余侠客
威 望:1
帖 子:302
专家分:295
注 册:2016-10-22
收藏
得分:0 
回复 2楼 jklqwe111
这里还有一段,麻烦您看看
//10.主函数。设定界面的颜色大小,调用工作区模块函数
void main()
{
    LinkList L=NULL;
    int flag=0;  //标志变量。标记通讯录是否建立
    int menu;//菜单选项
    char temp;
    system("color lf");
    printf("\n   ******************^@^欢迎使用通讯录系统**************\n");
    printf("\n   ********           1(!-!)通讯录的建立            \n");
    printf("\n   ********           2(!-!)插入通讯记录            \n");
    printf("\n   *******            3(!-!)查询通讯记录            \n");
    printf("\n   ********           4(!-!)删除通讯记录            \n");
    printf("\n   ********           5(!-!)显示通讯录信息          \n");
    printf("\n   ********           0(!-!)退出管理系统            \n");
    printf("\n   ******************^@^欢迎使用通讯录系统**************\n");
    printf("请选择0-5:");
      scanf("%d,&menu");
    while(menu!=0)
    {
        switch(menu)        //用于调用菜单的语句
        {
            case 1:L=creatIncreLink();//调用函数实现通讯录的建立
                   printf("建立通讯录  :");
                   printList(L);
                   flag=1;
                   break;
            case 2:if(flag==1)
                   {
                      int number,talenum;
                      char name[20],temp;
                      printf("请输入通讯录成员的学号和姓名;\n");
                      printf("请输入学号 : ");
                        scanf("%d",&number);
                      printf("请输入姓名 : ");
                        temp=getchar();
                        gets(name);
                      printf("请输入电话号码: ");
                        scanf("%d",&telenum);
                      p=(LinkList)malloc(LEN);     //分配新结点
                      p-> number=number;
                      strcpy(p->nanme,name);
                      insertYouXu(L,p);      //插入新结点
                      printf("插入后 ;");
                      printList(L);
                   }
                   else printf("\nERROR: 通讯录还没有建立,请先建立通讯录\n");
                   break;
            case 3:int way, n, s;         //查找方式
                   char na[20], temp;
                   if(L!=NULL)
                   {
                       if(flag)
                       {
                           printf("选择查找方式 :\n");
                           printf("          1.按学号   2.按姓名");
                           scanf("%d",&way);
                           if(way==1)
                           {
                               printf("\n 请输入学号:");
                               scanf("%d",&n);
                               s=searchNum(L,n);   //查找通讯录成员
                               if(s==0)
                               printf("无此通讯录成员,查找失败!\n");
                           }
                           else if(way==2)
                           {
                               printf("\n 请输入姓名:");
                               temp=getchar();
                               gets(na);
                               s=searchNum(L,na);
                               if(s==0)
                               printf("无此通讯录成员,查找失败!\n");
                            }
                       else printf("通讯录中无记录!\n");
                      }//endif(flag)
                   break;
                  }//endif(L!=NULL)
                else printf("通讯录中无记录!\n");
                break;
            case 4:int way;            //删除方式
            char temp;
            printf("选择删除方式:1.按序号  2.按学号  3.按姓名 \n");
              scanf("%d",&way);
              if(way==1)
              {
                  int n;
                  printf("请输入通讯录序号 : ");
                  scanf("%d",&n);
                  printf("删除后:\n");
                  deleteElem(L,n);            //按序号删除
                  printList(L);
              }
              else if(way==2)
                {
                    int n,f;
                    printf("请输入学号; ");
                    scanf("%d",&n);
                    f=delNum(L,n);     //按学号删除
                    if(f!=0)
                    {
                        printf("删除后: \n");
                        printList(L);
                    }
                    else printf("无该学号,删除失败!\n");
               }
               else if(way==3)
               {
                   char na[20],temp;
                   int f;
                   printf("\n 请输入姓名:");
                     temp=getchar();
                     gets(na);
                     f=delName(L,na);       //按姓名删除
                     if(f!=0)
                     {
                         printf("删除后 :\n");
                         printList(L);
                     }
                     else printf("无该学号,删除失败!\n");
                }
                else printf("ERROR");
                break;
            case 5:printf("当前通讯录内容如下 :\n");
                    printList(L);
                    break;            //打印通讯录
            case 0: exit(0);
            default: printf("\n 没有此功能,重新输入\n");
               }//endwitch
               printf("选择功能 : ");
               scanf("%d",&menu);
    } //endwhile
}  //endmain
2017-08-12 20:31
快速回复:关于C语言数据结构的BUG不能求解?
数据加载中...
 
   



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

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