In a C program write a function that accepts three arguments
In a C++ program, write a function that accepts three arguments: an array, the size of the array, and a number n. Assume that the array contains 20 integers. The function should display all of the numbers in the array that are greater than the number n.
Solution
Here is the C++ code for you:
//Write a function that accepts three arguments: an array, the size of the array, and a number n.
//Assume that the array contains 20 integers. The function should display all of the numbers
//in the array that are greater than the number n.
void ElementsGreaterThanN(int array[], int size, int n)
{
for(int i = 0; i < size; i++) //For each element in the element.
if(array[i] > n) //If that element is greater than n.
cout<<array[i]<<\"\\t\"; //Print it to the screen.
cout<<endl;
}
