Get Function not returning correct value

I trying trying to find the median but I get the incorrect value. So I assign median=4 and I still get the incorrect value. Can anyone please help me?
Last edited on
Shouldn't you set median before reading it?
I did that and the program would not stop running.
Last edited on
closed account (DSLq5Di1)
1
2
3
4
5
6
7
8
9
10
11
12
class Statistics: public Mode {
protected:
    int middle;//Store number of the array
    double median;
   
public:
    int set_Median();
    int get_Median()const{
        return median;
    } 

};
closed account (1vRz3TCk)
double median; int get_Median()
Type mismatch???
In your example:
1
2
Statistics cat; //Create object
cout<<"The Median = "<<cat.get_Median()<<endl;

you did not set median.
Topic archived. No new replies allowed.