Question
#include using namespace std; const int SIZE = 10; void displayGreaterThan( int [], int ); void displaySmallerThan( int [], int ); void displayArrayContent( int []);
#include
using namespace std;
const int SIZE = 10;
void displayGreaterThan(int[], int);
void displaySmallerThan(int[],int);
void displayArrayContent(int[]);
void displayLargestValue(int[]);
void displaySmallestValue(int[]);
int main(){
int number;
int numbers[SIZE] = {9,1,90,98,53,22,76,29,37,65};
cout <<"Enter a number: ";
cin >> number;
cout << endl;
displayGreaterThan(numbers,number);
cout << endl;
displaySmallerThan(numbers,number);
cout << endl;
displayArrayContent(numbers);
cout << endl;
displayLargestValue(numbers);
cout << endl;
displaySmallestValue(numbers);
cout << endl;
return 0;
}
void displayGreaterThan(int value[],int num){
cout << " All larger value(s)than" << num << ":" << endl;
for(int index = 0;index < SIZE;index++){
if(value[index] < num){
cout << value[index] << "";
}
}
//cout << " All larger value(s)than" << num << ":" << endl;
}
void displaySmallThan(int value[], int num){
cout << " All Smaller value(s)than" << num << ":" << endl;
for(int index = 0; index < SIZE; index++){
if(value[index] < num){
cout << value[index] << "";
}
}
//cout << " All Smaller value(s)than" << num << ":" << endl;
}
void displayArrayContent(int values[]){
for(int index = 0; index < SIZE; index++){
cout << values[index] << "" << endl;
}
}
void displayLargestValue(int values[]){
int num = values[0];
for(int index = 0; index > SIZE; index++){
if(values[index] > num){
num = values[index];
}
}
cout << " Largest value in array is " << num << endl;
}
void displaySmallestValue(int values[]){
int num = values[0];
for(int index = 0; index < SIZE; index++){
if(values[index] < num){
num = values[0];
}
}
cout << " Smallest value in array is " << num << endl;
}
Can someone tell me what happening to my c++ program? It keep telling me build fail.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started