can someone give me an example of how to use classes? i read the tuorial and still dont get it, just a simple example of how to use functions in a class. this is what i got so far but im getting 3 errors on this.
Code:#include <iostream>
using namespace std;
class Average
{
public:
float findaverage();
private:
int score;
float sum;
int NumScores;
};
float Average::findaverage()
{
float findaverage(int score, int NumScores);
cout <<"enter a score" << endl;
while ( score != 0 )
{
sum += score;
NumScores++;
cout << "Enter a test score ( 0 to quit ): ";
cin >> score;
}
return sum/NumScores;
}
int main()
{
Average Numbers;
Average.findaverage();
cout <<"The average is" << Average <<endl;
return 0;
}