首页 > 其他 > 详细

单链表复习

时间:2014-11-08 01:59:07      阅读:246      评论:0      收藏:0      [点我收藏+]
// linklist.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
struct student{
    long number;
    char name[10];
    float score;
    struct student *next;
};

int main(int argc, char* argv[])
{
    struct student a,b,c,*head,*p;
    a.number=110801; strcpy(a.name,"小明");  a.score=98;
    b.number=110802; strcpy(b.name,"小华");b.score=100;
    c.number=110803; strcpy(c.name,"张三");c.score=95;
    head=&a;
    a.next=&b;
    b.next=&c;
    c.next=NULL;
    p=head;
    do 
    {
        cout<<p->number<<"  "<<p->name<<"  "<<p->score<<endl;
        p=p->next;
    } while (p!=NULL);
        return 0;
}

 

单链表复习

原文:http://www.cnblogs.com/yaopan007/p/4082631.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!