#include <iostream>
using namespace std;
void greaterNumbers(const int[], int, int);
int main()
{
const int ARRAY_SIZE = 30;
int numbers_array[ARRAY_SIZE] = {1, 2, 3, 4, 5,
6, 7, 8, 9, 10,
11, 12, 13, 14, 15,
16, 17, 18, 19, 20,
21, 22, 23, 24, 25,
26, 27, 28, 29, 30};
int n = 20;
cout << "All numbers greater that " << n << " are: ";
greaterNumbers(numbers_array, ARRAY_SIZE, n);
cout << endl;
return 0;
} // END int main()
void greaterNumbers(const int array[], int ARRAY_SIZE, int n)
{
for (int i = 0; i < ARRAY_SIZE; i++)
{
if (array[i] > n)
{
if(i == ARRAY_SIZE - 1)
cout << array[i];
else
cout << array[i] << ", ";
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBncmVhdGVyTnVtYmVycyhjb25zdCBpbnRbXSwgaW50LCBpbnQpOwoKaW50IG1haW4oKQp7ICAgCiAgICBjb25zdCBpbnQgQVJSQVlfU0laRSA9IDMwOwogICAgaW50IG51bWJlcnNfYXJyYXlbQVJSQVlfU0laRV0gPSB7MSwgMiwgMywgNCwgIDUsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwgNywgOCwgOSwgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMSwgMTIsIDEzLCAxNCwgMTUsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTYsIDE3LCAxOCwgMTksIDIwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEsIDIyLCAyMywgMjQsIDI1LCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI2LCAyNywgMjgsIDI5LCAzMH07CiAgICBpbnQgbiA9IDIwOwoKICAgIGNvdXQgPDwgIkFsbCBudW1iZXJzIGdyZWF0ZXIgdGhhdCAiIDw8IG4gPDwgIiBhcmU6ICI7CiAgICBncmVhdGVyTnVtYmVycyhudW1iZXJzX2FycmF5LCBBUlJBWV9TSVpFLCBuKTsKICAgIGNvdXQgPDwgZW5kbDsKCiAgICByZXR1cm4gMDsKfSAvLyBFTkQgaW50IG1haW4oKQoKdm9pZCBncmVhdGVyTnVtYmVycyhjb25zdCBpbnQgYXJyYXlbXSwgaW50IEFSUkFZX1NJWkUsIGludCBuKQp7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IEFSUkFZX1NJWkU7IGkrKykKICAgIHsKICAgICAgICBpZiAoYXJyYXlbaV0gPiBuKQogICAgICAgIHsKICAgICAgICAgICAgaWYoaSA9PSBBUlJBWV9TSVpFIC0gMSkKICAgICAgICAgICAgICAgIGNvdXQgPDwgYXJyYXlbaV07CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgIGNvdXQgPDwgYXJyYXlbaV0gPDwgIiwgIjsKICAgICAgICAgICAgCiAgICAgICAgfQoKICAgIH0KICAgIAp9