need help

Im making an array program but i keep getting these errors here is my program:

//Hw9ShumateCedric My first array
#include<iostream>
#include<iomanip>
#include<cmath>
#include<fstream>
using namespace std;

const int MAXVALUE = 101;
int (resist[]);
double findMax(double resist[], int numValues);
double findMin(double resist[], int numValues);
double calcMean(double resist[], int numValues);
double geoMean(double resist[], int numValues);
double rmsAvg(double resist[], int numValues);
double harmMean(double resist[], int numValues);

int main(){
double resist[MAXVALUE];
double max, min, mean, geo_Mean, rms_Avg, harm_Mean;
int numValues;
ifstream infile ("resist.txt");

cout<<" , Program 9"<<endl;
cout<<"Sample Resistance Study"<<endl;

numValues = loadArray(resist);

max = findMax(resist, numValues);
cout<<"\n The maximum value is"<<setw(10)<<fixed<<setprecision(2)<<max<<endl;

min = findMin(resist, numValues);
cout<<"The minimum value is "<<setw(10)<<fixed<<setprecision(2)<<min<<endl;

mean = calcMean(resist, numValues);
cout<<"The mean is "<<setw(23)<<fixed<<setprecision(6)<<mean<<endl;

geo_Mean = geoMean(resist, numValues);
cout<<"The geometric mean is "<<setw(13)<<fixed<<setprecision(6)<<geo_Mean<<endl;

rms_Avg = rmsAvg(resist, numValues);
cout<<"The rms average is "<<setw(16)<<fixed<<setprecision(6)<<rms_Avg<<endl;

harm_Mean = harmMean(resist, numValues);
cout<<"The harmonic mean is "<<setw(14)<<fixed<<setprecision(6)<<harm_Mean<<endl;

cout<<"\n The sorted list of values is: "<<endl;

return 0;

}

int loadArray(double resist[MAXRESIST]){
int numValues = 0;
ifstream infile ("resist.txt");
for (int i = 0; i<MAXRESIST; i++){
if (infile){
infile>>resist[i];
numValues = i;}
}
return numValues;
}

double findMin(double resist[MAXRESIST], int numValues){
int index = 0;
double min = resist[index];
for (int i=0; i<numValues; i++){
if (resist[i]<min)
min=resist[i];
}
return min;
}

double calcMean (double resist[MAXRESIST], int numValues){
double sum = 0, mean;
for (int i = 0; i<numValues; i++){
sum=sum+resist[i];}
mean = sum / numValues;
return mean;
}

double geoMean(double resist[MAXRESIST], int numValues){
double product = resist[0], geoMean;
for(int i = 1; i<numValues; i++){
product= product * resist[i];}
geoMean= pow(product,(1.0/numValues));
return geoMean;
}

double rmsAvg(double resist[MAXRESIST], int numValues){
double product, sum= 0, rmsAvg;
for(int i=0, i<numValues; i++){
product=resist[i]*resist[i];
sum=sum + product;}
rmsAvg= sqrt((1.0/numValues)*sum);
return rmsAvg;
}

double harmMean(double resist[MAXVALUE], int numValues){
double sum = 0, harmMean;
for(int i=0; i<numValues; i++){
sum = sum + 1.0/resist[i]:}
harmMean= numValues/sum;
return harmMean;
}



and here is the output:
1>------ Build started: Project: HW9Shumate, Configuration: Debug Win32 ------
1>Build started 5/7/2012 11:37:50 AM.
1>InitializeBuildStatus:
1> Touching "Debug\HW9Shumate.unsuccessfulbuild".
1>ClCompile:
1> HW9Shumate.cpp
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(26): error C3861: 'loadArray': identifier not found
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(52): error C2065: 'MAXRESIST' : undeclared identifier
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(55): error C2065: 'MAXRESIST' : undeclared identifier
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(63): error C2065: 'MAXRESIST' : undeclared identifier
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(73): error C2065: 'MAXRESIST' : undeclared identifier
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(81): error C2065: 'MAXRESIST' : undeclared identifier
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(89): error C2065: 'MAXRESIST' : undeclared identifier
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(91): error C2143: syntax error : missing ',' before '<'
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(91): error C2086: 'int i' : redefinition
1> d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(91) : see declaration of 'i'
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(91): error C2143: syntax error : missing ';' before ')'
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(91): error C2143: syntax error : missing ';' before ')'
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(91): error C2143: syntax error : missing ';' before '{'
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(101): error C2143: syntax error : missing ';' before ':'
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(101): error C2143: syntax error : missing ';' before ':'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.42
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Last edited on
loadArray function must be declared or defined before you try to use it.

MAXRESIST has never been created.

Is this line 91?
for(int i=0, i<numValues; i++){
Take a look at it and see the error you made (hint; between the 0 and the i)
ok thanks ive attempted to fix the problems and here is what my output looks like now, also how would i declare loadArray;

1>------ Build started: Project: HW9Shumate, Configuration: Debug Win32 ------
1>Build started 5/7/2012 11:54:16 AM.
1>InitializeBuildStatus:
1> Touching "Debug\HW9Shumate.unsuccessfulbuild".
1>ClCompile:
1> HW9Shumate.cpp
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(26): error C3861: 'loadArray': identifier not found
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(92): error C2065: 'i' : undeclared identifier
1>d:\student\hw9shumate\hw9shumate\hw9shumate.cpp(92): error C2065: 'i' : undeclared identifier
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.33
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
how would i declare loadArray


int loadArray(double* resist);
Topic archived. No new replies allowed.