| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 468 人关注过本帖
标题:帮我看看这程序哪错了
只看楼主 加入收藏
rony
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-4-6
收藏
 问题点数:0 回复次数:1 
帮我看看这程序哪错了

看看这个程序错哪了,谢谢!




#include<iostream.h>
class student
{public:

void scoretotalcount(float s);
static float sum();
static float average();
student*next;
private:
float score;
static float total;
static int count;
};

void student::scoretotalcount(float s)
{score=s;total+=score;count++;}
float student::sum()
{return total;}
float student::average()
{float average=total/count;return average;}
void add(student*&f,student*&r,float s)
{student *p=new student;
p->scoretotalcount(s);
p->next=NULL;
if(f==NULL)
{f=r=p;}
else
{r->next=p;r=r->next;}

void main()
{student * front=NULL;student * rear=NULL;
float s;
int choice;
do
{cout<<"请选择是否继续输入"<<endl;
cout<<"输入1继续,\n输入0结束\n";
cin>>choice;
switch(choice)
{case 1:
{ cout<<"输入成绩:";
cin>>s;
add(front,rear,s);
break;
}
case 0:
{break;}
}
cout<<"总分数是:"<<student::sum()<<endl;
cout<<"平均分是:"<<student::average()<<endl;
}while(choice);

}

搜索更多相关主题的帖子: private average include public 
2007-04-06 05:09
Garand
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2006-5-27
收藏
得分:0 
void add(student*&f,student*&r,float s)

因为你这个函数后面少了一个}

排版太乱了
2007-04-07 12:30
快速回复:帮我看看这程序哪错了
数据加载中...
 
   



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

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