| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 450 人关注过本帖
标题:非法操作的问题何在?
取消只看楼主 加入收藏
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
快速回复:非法操作的问题何在?
数据加载中...
 
   



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

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