Hello, I have been trying to figure out how to make an array work with a calculator that uses up to 100 different inputs to calculate sum, difference, standard deviation min max etc. When I try to compile the code I get (error: no match for 'operator<<' on line 64 being max=arrayVal[i]'. I've only done very basic concepts with arrays till now where I would ask for individual input for a 4 or 5 element array. So i do not know if I am using the interger and for statements in this properly. Thank you all for the help in advance =D.
#include <iostream>
#include <math.h>
#include <cmath>
using namespace std;
int main ()
{
float sum = 0.0;
float sub = 0.0;
float variance = 0.0;
float mult = 1.0;
float mean = 0.0;
int i;
float arrayVal[100];
int n=0;
cout<<"input your values"<<endl;
do
{
for (i=0;i<100;i++)
cin>>arrayVal[i];
sum += arrayVal[i];
if (n == 0)
{
sub = arrayVal[i];
}
else
{
sub-=arrayVal[i];
}
mult *= arrayVal[i];
float max = arrayVal[0];
if (max>= arrayVal[i])
{
max=arrayVal[i];
}
float min = arrayVal[0];
if (min <= arrayVal[i])
{
min=arrayVal[i];
}
n++; // n represents the number of values input by the user
}
while (i<100 && arrayVal[i]!=0);
mean = sum/n;
for (i=0;i<100;i++)
{
variance += pow((arrayVal[i]-mean),2);
}
float standDev = sqrt(variance);
cout<<"Sum = "<<sum<<endl;
cout<<"Sub = "<<sub<<endl;
cout<<"Mult = "<<mult<<endl;
cout<<"Max = "<<max<<endl;
cout<<"Min = "<<min<<endl;
cout<<"Mean = "<<mean<<endl;
cout<<"Variance = "<<variance<<endl;
cout<<"Standard Deviation = "<<standDev<<endl;
return 0;
}