Code:
#include <iostream.h> --> <iostream>
However, you never use <iostream> in that file anyway.
----
The thing i'm not sure about are these two functions:
Code:
void values::get_sum_number()
{
total=0;
for ( int i = 0; i < 20; i++)
{ total +=[i];
}
sum = total;
}
-----
Code:
class values
{
public:
void get_largest_number();
void get_smallest_number();
void get_sum_of_number();
void get_mean_of_number();
protected:
int sum = 0;
int mean = 0;
};
This ain't Java. In C++, you can can't initialize class member variables in the class declaration. You need to use a constructor to initialize those variables.
---
By convention, class names are capitalized.
Since the class name is 'values' wouldn't it make more sense to make the array a member variable? And if 'sum' and 'mean' are member variables, why aren't 'smallest' and 'largest'?
Think about how your get_sum_number() function works. Are you going to calculate the sum of the array every time someone needs it? That seems like a waste since it only needs to be calculated once. Or, are you going to calculate the sum once and then store the sum in the member variable 'sum'? If you calculate it once and store the result in the member variable 'sum', how will the user be able to access 'sum' to get its value?
Also, look at the way you are calculating the sum and mean:
Code:
void values::get_sum_number()
{
total=0;
for ( int i = 0; i < 20; i++)
{ total +=[i];
}
sum = total;
}
void values::get_mean_number()
{
for ( int i = 0; i < 20; i++)
{ sum +=a[i];
}
mean = sum / 20;
}
Where does a[i] come from? It's not a parameter of the function, it's not a local variable you declared in the function, and it's not a class member.
Also, if you calculate the sum of an array and store it in the member variable sum, what is the idea behind adding more numbers to sum in the function get_mean_number()?