吃药能不能吃萝卜:C++高手来

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/04 16:57:08
关于C++ 的一个问题~
请大家帮帮看这个程序哪个两个地方错了,运行不出来
#include<iostream.h>
#include<stdlib.h>
#include<fstream.h>
class student
{public:
float scretotalcount(float);
static float sum();
static float average();
public:
float score;
static float total;
static float count;
};
float student::total=0;
float student::count=0;
float student::scretotalcount()
{total+=score;
count++;}
float student::sum()
{return total;}
float student::average()
{return total/count;}
void main()
{student d;
cout<<"请输入成绩"<<endl;
while(cin>>score)
{d.scretotalcount(score);}
cout<<d.sum()<<d.average()<<endl;}
#include<iostream.h>
#include<stdlib.h>
#include<fstream.h>
class student
{public:
float scretotalcount(float);
static float sum();
static float average();
public:
float score;
static float total;
static float count;
};
float student::total=0;
float student::count=0;
float student::scretotalcount()
{total+=score;
count++;}
float student::sum()
{return total;}
float student::average()
{return total/count;}
void main()
{student d;
cout<<"请输入成绩"<<endl;
while(cin>>score)
{d.scretotalcount(score);}
cout<<d.sum()<<d.average()<<endl;}
请指出具体错误在哪 谢谢!!

look!
see
thank you

错误太多了
又看不懂你写的顺序
真有一点不好找