| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 823 人关注过本帖
标题:代码有点看不懂
取消只看楼主 加入收藏
jjg
Rank: 2
等 级:论坛游民
帖 子:67
专家分:42
注 册:2009-8-19
结帖率:46.15%
收藏
已结贴  问题点数:20 回复次数:0 
代码有点看不懂
#include <iostream>
using namespace std;


struct student
{
    long number;
    float score;
    student * next;
};
student * head;
student * create()
{
    student * ps;
    student * pend;
    ps=new student;
    cin>>ps->number;cin>>ps->score;

    head=NULL;
    pend=ps;
    while(ps->number!=0)
    {
        if(head==NULL)
            head=ps;
        else
            pend->next=ps;
        pend=ps;
        ps=new student;
        cin>>ps->number>>ps->score;

    }
    pend->next=NULL;
    delete ps;
    return(head);
}
void showlist(student* head)
{
    cout<<"now the items of list are";
    while(head)
    {
        cout<<head->number<<","<<head->score<<endl;
        head=head->next;
    }
}
void main()
{
    showlist(create());
}
上面红色代码是一样的,有什么不同的作用吗?
搜索更多相关主题的帖子: 代码 
2009-10-18 16:13
快速回复:代码有点看不懂
数据加载中...
 
   



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

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