标题:求助,链表问题
取消只看楼主
dlptiger
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-3-3
 问题点数:0 回复次数:0 
求助,链表问题
#include<iostream.h>
class student
{
public:
    char *name;
    char *number;
    int score;
    student *next;
};

void main()
{
    student *p=new student;
    cin>>p->name>>p->number>>p->score;
    student *head=p;
    for(int i=0;i<1;i++)
    {
        student *q=new student;
        cin>>q->name>>q->number>>q->score;
        p->next=q;
        p=p->next;
    }
    p=head;
    while(p!=0)
    {
        cout<<p->name<<"  ";
        cout<<p->number<<"  ";
        cout<<p->score<<"  ";
        cout<<endl;
        p=p->next;
    }
}
运行不通过,请高手指点一下……
搜索更多相关主题的帖子: 链表 
2009-09-15 09:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-285766-1-1.html




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

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