新手问题.....

ZMAK_Chun 2008-10-28 01:57:00

#include<iostream>
#include <string>
using namespace std;

typedef struct student
{
long stuNo;
float score;
string stuName;
struct student *next;
}linkList;
linkList *head,*p;

linkList *createList()
{
long _stuNo;
float _score;
string _stuName;
linkList *head,*r,*p;
head=new linkList;
p=head;
head->next=NULL;
r=p;
cout<<"StuNo=";
cin>>_stuNo;
cout<<"stuNmae=";
cin>>_stuName;
cout<<"score=";
cin>>_score;
while(_stuNo!=0)
{
p=new linkList;
p->stuNo=_stuNo;
p->stuName=_stuName;
p->score=_score;
p->next=NULL;
r->next=p;
r=r->next;
cout<<"StuNo=";
cin>>_stuNo;
cout<<"stuNmae=";
cin>>_stuName;
cout<<"score=";
cin>>_score;
}
return(head);
}

outPut(linkList *s)
{
linkList *p;
p=s->next;
while(p!=NULL)
{
cout<<"SutNo: "<<p->stuNo<<"\t";
cout<<"StuName: "<<p->stuName<<"\t";
cout<<"score: "<<p->score<<endl;
p=p->next;
}
cout<<"输出结束"<<endl;
}

void Del(linkList *head,long _stuNo)
{
linkList *q;
linkList *p;
p=head;
while(p->next!=NULL && p->next->stuNo!=_stuNo)
{
p=p->next;
}
if(p->next==NULL)
cout<<"该学号不存在"<<endl;
else
{
q=p->next;
p->next=q->next;
delete q;
}
}
void Insert(linkList *head,long stuNo,long _stuNo,string _stuName,float _score)
{
linkList *s,*q,*p;
s=new linkList;
s->stuNo=_stuNo;
s->stuName=_stuName;
s->score=_score;
q=head;
p=head->next;
while(p!=NULL && p->stuNo!=stuNo)
{
q=p;
p=p->next;
}
q->next=s;
s->next;
}

int main()
{
return 1;
}

出现
错误 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\C++\10.25\LinkList\LinkList\linkList.cpp 50
的错误..何解..
...全文
51 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
deerwin1986 2008-10-28
  • 打赏
  • 举报
回复
函数output的返回值问题。。。 设成void就好。。。C++不支持默认int返回值。
树先生 2008-10-28
  • 打赏
  • 举报
回复
好像问题还不少 至少new delete就没处理好啊
ZMAK_Chun 2008-10-28
  • 打赏
  • 举报
回复
。。。。不小心把void 去掉了..sorry...请无视

65,210

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧