求解C语言程序改错问题让用随机函数生成至少30000个整数


#include
#include
#include
#define N 40000
using namespace std;


 struct Student
 {   
    int score;
    struct Student *next;
 };//创建单向链表,返回链表表头head
 struct Student *CreatLink(struct Student *head ,int n)
 {   
    int i;
    struct Student *p1,*p2;
    head=p1=(struct Student *)malloc(sizeof(struct Student));
    if(p1 == NULL)
    {   
        cout<<"Not enough memory to allocate buffer"<system("PAUSE");
        //exit(1); /* terminate program if out of memory */
    }
    p1->score = rand()%101;//产生随机值
    p1->next=NULL;
    for(i=2;i<=n;i++)
    {   
        p2=p1;
        p1=(struct Student *)malloc(sizeof(struct Student));
        if(p1 == NULL)
        {      
            cout<<"Not enough memory to allocate buffer"<system("PAUSE");
            exit(1); /* terminate program if out of memory */
        }
            p1->score = rand()%101;
            p1->next=NULL;//最近产生的节点下一节点指向空
            p2->next=p1;
    }
        return head;
 }//显示循环链表的成员

    void DisplayLink(struct Student *head)
    {   
        struct Student *p;
        p=head;
        do
        {   
            cout<score<next;
        }
        while(p!=NULL); //p再次与head相等时,即所有成员都遍历完成
        printf("\\n\\n");
    }

要先用srand函数生成随机种子