C++编程:编写一个函数print,将第6题建立的链表中各结点的数据依次输出。

2016-06-24 15:01:31  分类: c++程序设计第三版谭浩强课后答案  参与:
C++编程:编写一个函数print,将第6题建立的链表中各结点的数据依次输出。

以下是此题的【c++源代码】
#include <iostream>
using namespace std;
#define NULL 0    
struct student
{long num;
 float score;
 student *next;
};   
int n;                   
void print(student *head)
 {student *p;
  cout<<"Now,These "<<n<<" records are:"<<endl;
  p=head;
  if(head!=NULL)
  do
    {cout<<p->num<<"  "<<p->score<<endl;
     p=p->next;
 }while(p!=NULL);
}

来源:c++程序设计第三版谭浩强课后答案

本文链接:http://www.wb98.com/cjia/post/cjia_7.7.html


本站文章搜索:

<< 上一篇下一篇 >>

搜索

Tags列表

赞助商链接