#include
struct NODE
{
int id;
int wage;
NODE*next;
};
class List
{
NODE*head;
public:
List(){head=NULL;}
void InsertList(int aid,int bid,int bwage);
void CreateList();
void OutputList();
};
void List::OutputList() //输出链表
{
NODE*current=head;
while(current!=NULL)
{
cout<
}
}
void List::InsertList(int aid,int bid,int bwage) //插入一个数据
{
NODE*p,*q,*s;
s=(NODE*)new(NODE);
s->id=bid;
s->wage=bwage;
p=head;
if(head==NULL)
{
head=s;
s->next=NULL;
}
else
if(p->id==aid) //aid 为链表的头一个数据
{
s->next=p;
head=s;
}
else
{
while(p->id!=aid&&p->next!=NULL)
{
q=p;
p=p->next;
}
if(p->id==aid)
{
q->next=s;
s->next=p;
}
else
{
p->next=s;
s->next=NULL;
}
}
}
void List::CreateList()
{
int id,idd,wage,n;
cout <<"请输入职工数量:";
cin >> n;
cout <<"请输入第1个职工信息:"<
cin >> idd;
cout <<"请输入工资:";
cin >> wage;
this->InsertList(idd,idd,wage);
for(int i=1; i
cout <<"请输入第"< cout <<"请输入职工号: ";
cin >> id;
cout <<"请输入工资:";
cin >> wage;
this->InsertList(idd,id,wage);
}
}
void main()
{
List A;
A.CreateList();
cout<<"\n链表A:"<
}
你的scanf("%f,%f",&a,&b);
那么输入时必须是 1.5,2.5
加上return(z);
就行了,我已经运行过了,没有错
问题不详细