| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 448 人关注过本帖
标题:链表的新建插入问题-》未解决的外表问题
只看楼主 加入收藏
影随风
Rank: 2
等 级:论坛游民
帖 子:38
专家分:24
注 册:2013-3-14
结帖率:85.71%
收藏
 问题点数:0 回复次数:0 
链表的新建插入问题-》未解决的外表问题
说有未解绝的外表为题:求助
  学生信息管理(新建、插入).obj : error LNK2001: unresolved external symbol _Create_Stu_Doc
  Debug/学生信息管理(新建、插入).exe : fatal error LNK1120: 1 unresolved externals
  执行 link.exe 时出错.

学生信息管理(新建、插入).exe - 1 error(s), 0 warning(s)

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct stud_node
{
    int num,score;
    char name[20];
    struct stud_node *next;
};
struct stud_node *Create_Stu_Doc();/*新建链表*/
struct stud_node *InsertDoc(struct stud_node *head,struct stud_node *stud);/*插入*/

int main(void)
{
    struct stud_node *head,*p;
    int choice,num,score;
    char name[20];
    int size=sizeof(struct stud_node);
    do
    {
        printf("1:Creat 2:Insert 3:Delete 4:Print 0:Exit\n ");
        scanf("%d",&choice);
        switch(choice)
        {
            case 1:
                head=Create_Stu_Doc();
                break;
        
            case 0:
                break;
        }
    }while(choice!=0);
    return 0;
}
/*新建链表*/
struct stud_node *Creat_Stu_Doc()
{
    struct stud_node *head,*p;
    int num,score;
    char name[20];
    int size=sizeof(struct stud_node);

    head=NULL;
    printf("Iuput num,name and score:\n ");
    scanf("%d%s%d",&num,name,&score);
    while(num!=0)
    {
        p=(struct stud_node *)malloc(size);
        p->num=num;
        strcpy(p->name,name);
        p->score=score;
        head=InsertDoc(head,p);
        scanf("%d%s%d",&num,name,&score);
    }
    return head;
}
/*插入操作*/
struct stud_node *InsertDoc(struct stud_node *head,struct stud_node *stud)
{
    struct stud_node *ptr,*ptr1,*ptr2;

    ptr2=head;
    ptr=stud;

    if(head==NULL)
    {

        head=ptr;
        head->next=NULL;
    }
    else
        {
            while((ptr->num>ptr2->num)&&(ptr2->next!=NULL))
            {
                ptr1=ptr2;
                ptr2=ptr2->next;
            }
            if(ptr->num<=ptr2->num)
            {
                if(head==ptr2)
                    head=ptr;
                else
                    ptr1->next=ptr;
                ptr->next=ptr2;
            }
            else
            {
                ptr2->next=ptr;
                ptr->next=NULL;
            }
        }
    return head;
}
搜索更多相关主题的帖子: 信息 学生 include warning 
2013-05-05 10:01
快速回复:链表的新建插入问题-》未解决的外表问题
数据加载中...
 
   



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

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