#include <iostream> using namespace std; //function prototypes int sum( int [],
ID: 3549008 • Letter: #
Question
#include <iostream>
using namespace std;
//function prototypes
int sum(int [], int);
int countNmbrsBigger(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;
//FINISH WRITING CODE TO USE THE REMAINING 5 FUNCTIONS HERE
}
//function definitions
int sum(int theArray [], int theArraySize){
//returns the sum of the values in theArray
int theSum = 0;
for (int i = 0; i < theArraySize; i++){
theSum += theArray[i];
}
return theSum;
}
//FINISH THESE FUNCTION DEFINITIONS
int countNmbrsBigger(int theArray [], int theArraySize, int Number){
//count the value in the array greater than
//the parameter
Explanation / Answer
#include <iostream>
using namespace std;
//function prototypes
int sum(int [], int);
int countNmbrsBigger(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 <<"ENTER NUMBER TO GET NUMBER GREATER THEN IT : ";
cin >> num ;
cout <<"COUNT NUMBER BIGGER THEN "<<num <<" : "<<countNmbrsBigger(theArray, arraySize,num) <<endl ;
cout <<"AVERAGE : "<<average(theArray, arraySize) <<endl;
cout <<"HIGHEST NUMBER : "<<high(theArray, arraySize) <<endl;
cout <<"LOWEST NUMBER: "<<low(theArray, arraySize) <<endl;
cout <<"ENTER NUMBER TO SEARCH : ";
cin >> num;
cout <<"FIND NUMBER "<<num <<" in subscript : "<<find(theArray, arraySize , num) <<endl;
return 0 ;
}
//function definitions
int sum(int theArray [], int theArraySize){
//returns the sum of the values in theArray
int theSum = 0,i;
for ( i = 0; i < theArraySize; i++){
theSum += theArray[i];
}
return theSum;
}
//FINISH THESE FUNCTION DEFINITIONS
int countNmbrsBigger(int theArray [], int theArraySize, int Number){
//count the value in the array greater than
//the parameter
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.