#include <iostream>
using namespace std;
void insert(int *arr, int num);
int n;
void returnGT(int arr[]);
int main(){
cout<< "Enter the number of integers: "<<endl;
cin>>n;
int num[n];
insert(num, n);
returnGT(num);
}
void insert(int *arr, int num){
for (int i = 0; i < num; i++){
cout<< "Enter item "<< i + 1 << " : ";
cin>> arr[i];
}
}
void returnGT(int arr[]){
int sentinel;
cout<< "Enter sentinel: ";
cin>> sentinel;
for (int i = 0; i < n; i++){
if (arr[i] > sentinel){
cout<< arr[i] << " ";
}
}
}
Explanation:
The C++ source code defines an array of integer values, the program prompts for user input for the array size and the sentinel value to fill the array with input values and output integer values greater than the sentinel.