im haveing problems with the following piece of code
in getting an error durring compilling which says
error c2065; 'arraySize' : undeclared identifier line 54
error c2065: 'anArray' : undeclared identifer line 55
(Shown underlined and in Itilacs in the code
[code=c]
#include <iostream>
using namespace std;
int sum(int [], int);
int countNmbrsBigge r(int [], int, int);
int average(int [], int);
int high(int [], int);
int low(int [], int);
int find(int [], int, int);
int main (void ){
//test the array class
const int arraySize = 10;
int theArray[arraySize] = {1, 5, 25, 10, 12, 9, 24, 24, 22, 2};
cout << "Sum: " << sum(theArray, arraySize) << endl;
cout << "Count of numbers bigger than 10: " << countNmbrsBigge r(theArray, arraySize, 10) << endl;
cout << "Average: " << average(theArra y, arraySize) << endl;
cout << "High: " << high(theArray, arraySize) << endl;
cout << "Low: " << low(theArray, arraySize) << endl;
cout << "Find: " << find(theArray, arraySize, 25) << endl;
cout << "Find: " << find(theArray, arraySize, 100) << endl;
}
int sum(int theArray [], int theArraySize){
//returns the sum of the values in theArray
int sum = 0;
for (int i = 0; i < arraySize; i++) {
[I]sum += anArray;
}
return sum;
}
int countNmbrsBigge r(int theArray [], int theArraySize, int Number){
//count the value in the array greater than
//the parameter
}
int average(int theArray [], int theArraySize){
//average the values in the array
}
int high(int theArray [], int theArraySize){
//find the highest value in the array
}
int low(int theArray [], int theArraySize){
//find the lowest value in the array
int lowValue = theArray[0];
for (int i = 0; i < theArraySize; i++){
if (theArray[i] < lowValue){
lowValue = theArray[i];
}
}
return lowValue;
}
int find(int theArray [], int theArraySize, int theNumber){
//return the subscript of the supplied argument
//return -1 if not found
}[/code]
in getting an error durring compilling which says
error c2065; 'arraySize' : undeclared identifier line 54
error c2065: 'anArray' : undeclared identifer line 55
(Shown underlined and in Itilacs in the code
[code=c]
#include <iostream>
using namespace std;
int sum(int [], int);
int countNmbrsBigge r(int [], int, int);
int average(int [], int);
int high(int [], int);
int low(int [], int);
int find(int [], int, int);
int main (void ){
//test the array class
const int arraySize = 10;
int theArray[arraySize] = {1, 5, 25, 10, 12, 9, 24, 24, 22, 2};
cout << "Sum: " << sum(theArray, arraySize) << endl;
cout << "Count of numbers bigger than 10: " << countNmbrsBigge r(theArray, arraySize, 10) << endl;
cout << "Average: " << average(theArra y, arraySize) << endl;
cout << "High: " << high(theArray, arraySize) << endl;
cout << "Low: " << low(theArray, arraySize) << endl;
cout << "Find: " << find(theArray, arraySize, 25) << endl;
cout << "Find: " << find(theArray, arraySize, 100) << endl;
}
int sum(int theArray [], int theArraySize){
//returns the sum of the values in theArray
int sum = 0;
for (int i = 0; i < arraySize; i++) {
[I]sum += anArray;
}
return sum;
}
int countNmbrsBigge r(int theArray [], int theArraySize, int Number){
//count the value in the array greater than
//the parameter
}
int average(int theArray [], int theArraySize){
//average the values in the array
}
int high(int theArray [], int theArraySize){
//find the highest value in the array
}
int low(int theArray [], int theArraySize){
//find the lowest value in the array
int lowValue = theArray[0];
for (int i = 0; i < theArraySize; i++){
if (theArray[i] < lowValue){
lowValue = theArray[i];
}
}
return lowValue;
}
int find(int theArray [], int theArraySize, int theNumber){
//return the subscript of the supplied argument
//return -1 if not found
}[/code]
Comment