码迷,mamicode.com
首页 > 其他好文 > 详细

单链表复习

时间:2014-11-08 02:01:48      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   color   ar   os   sp   for   div   

// 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;
}

 

单链表复习

标签:style   blog   io   color   ar   os   sp   for   div   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!