Question
Could someone write this for me is c++? I can't seem to figure out the loops to display the arrays. This is everything so far:
Could someone write this for me is c++? I can't seem to figure out the loops to display the arrays.
This is everything so far:
#include
using namespace std;
// Global constants
const int SIZE = 10; // The size of the array
// Function prototypes
void displayGreaterThan(int[], int);
void displaySmallerThan(int[], int);
void displayArrayContent(int[]);
void displayLargetValue(int[]);
void displaySmallestValue(int[]);
int main()
{
int number; // To hold a number.
// Define an array of integers.
int numbers[SIZE] = { 1, 23, 43, 54, 4, 34, 2, 5, 7, 9 };
// Get a number as input from the user.
cout
cin >> number;
cout
displayGreaterThan(numbers, number);
cout
return 0;
}
// ********************************************************
// The displayGreaterThan function accepts two arguments: *
// an integer array and a number n, and it displays all *
// of the numbers in the array that are greater than the *
// number n. *
// ********************************************************
void displayGreaterThan(int values[], int n)
{
cout
// Step through the array.
for (int i = 0; i
{
// Determine if a number is greater than n.
if (values[i] > n)
{
// If so, display the number.
cout
}
}
cout
}
Write a program that will have a predefined array and then asks the user to enter an integer value cal i number. Then write the following functions to display: All values larger than number found in the array. Here is the function prototype: . o void displayGreaterThan(int[], int); All values smaller than number found in the array. Here is the function's proioiype o void displaySmallerThan(intl[], int) o void displayArrayContent(int[D o void displayLargetValue(int[]): o void displaySmallestValue(intl]): All values in the array. Here is the function's prototype: .The largest value in the array. Here is the function's prototype: The smallest value in the array. Here is the function's prototypeStep 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