Hello, I am trying to start implementing functions from a class into my Calculator just to get used to the idea of it. when I tried calling for my min max functions into my calculations function it is spitting out an error arguement of type "float" is not compatable with parameter of type "float". I have tried everything I could think of which is probably not much since i've only been doing programming for maybe 2-3 weeks XD. But want to thank you all in advance for the help.
header file
#pragma once
class calc
{
private:
int Size;
float sum;
int x;
float Max;
float Min;
float mult;
float var;
float stdev;
float sub;
float valArr[100];
float avg;
public:
calc();
void calculations();
void outputs();
void inputs();
bool cont();
float difference();
void maxValue(float valArr[],int Size);
void minValue(float valArr[],int Size);
};
calc.cpp (portion that im having the issue)
void calc::calculations()
{
for (x=0;x<Size;x++)
{
std::cin>>valArr[x];
maxValue(valArr[x],Size);//error here
minValue(valArr[x],Size);//error here
sum+=valArr[x];
difference();
mult*=valArr[x];
}
avg = sum/x;
for (int x=0; x<Size; x++)
{
var += (valArr[x] - avg) * (valArr[x] - avg);
}
var /= x-1;
float standDev = sqrt(var);
}
void calc::maxValue(float valArr[],int Size)
{
float Max = valArr[0];
for (int x=1; x<Size;x++)
{
if (valArr[x]>Max)
Max=valArr[x];
}
}
void calc::minValue(float valArr[],int Size)
{
float Min = valArr[0];
for (int x=1; x<Size;x++)
{
if (valArr[x]<Min)
Min=valArr[x];
}
}
probably should have not started with arrays also to start learning to implement functions and call functions with parameters XD.