标题:非法操作的问题何在?
取消只看楼主
CNick
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-5-16
 问题点数:0 回复次数:0 
非法操作的问题何在?

#include<iostream.h>
struct node
{
int music[10];
char name[10];
int i;
node *next;
};

class LinkList
{
public:
LinkList()
{
first=NULL;
n=0;
}
void Insert(int pos,const &x);
void Setup();
void Display();
int length()
{
return n;
}
node* SetPos(int pos);
protected:
node *first;
int n;
};

node* LinkList::SetPos(int pos)
{
node *q=first;
for(int i=0;i<pos;i++)
q=q->next;
return q;
}

void LinkList::Setup()
{
node *q,*p;
node m1={{1,2,3,4,5},"小蜜蜂",1};
q=new node;
q=&m1;
q->next=first;
first=q;
node m2={{5,4,3,2,1},"遇见",2};
p=new node;
p=&m2;
p->next=q->next;
q->next=p;
n+=2;
}

void LinkList::Display()
{
node *m=first->next;
cout<<"歌曲库显示\n";
for(int a=1;a<=n;a++)
{
cout<<a<<'.'<<m->name<<endl;
m=m->next;
}
}
void main()
{
LinkList nick;
nick.Setup();
nick.Display();
}

提示非法..请指教.....

搜索更多相关主题的帖子: include public music return 
2006-07-01 11:24



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-76026-1-1.html




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

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