| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 613 人关注过本帖
标题:关于建立动态链表的问题
取消只看楼主 加入收藏
c盘格式化
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-4-3
收藏
 问题点数:0 回复次数:0 
关于建立动态链表的问题
题目是建立一个动态链表,请各位大侠帮我看一下哪里出错了,我看了N久都没有找出错误
#include<iostream.h>
#include<stdio.h>
#include<malloc.h>
#define NULL 0
#define LEN sizeof(struct student)
struct student
{
int num;
int score;
struct student *next;
};
int n;
struct student *cread(void)
{
struct student *head,*p1,*p2;
n=0;
head=NULL;
while(p1->num!=0)
{
p1=(struct student*)malloc(LEN);
n++;
cout<<"please iput the numble and score:";
cin>>p1->num;
cin>>p1->score;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
}
p1->next=NULL;
return(head);
}
int main()
{
struct student *p;
p=cread();
return 0;
}
搜索更多相关主题的帖子: 链表 动态 
2007-05-19 17:18
快速回复:关于建立动态链表的问题
数据加载中...
 
   



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

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