rendered paste body/********************************* CISY 2311 : C/C++ Programming ASSIGNMENT 1 By: KEVIN YIN KEI CHAN *********************************/// header includes#include <iostream>#include <stdlib.h>using namespace std;// Prototypesvoid fill_random_numbers (int []);int count_odd_numbers (int []);void sort_array (int []);void swap_integers (int&, int&);void display_sorted_array (int []);void display_odd_count (int []);bool is_odd (int);// Define global constantsconst int ARRAY_SIZE = 50;const int RANDOM_MAX = 50;int main(void) { while(true) { // new seed srand(time(NULL)); // Initialize the array and fill it with random numbers int numbers[ARRAY_SIZE]; fill_random_numbers(numbers); // Output display_sorted_array(numbers); display_odd_count(numbers); cout << "\n========= Press ctrl-c to exit ========= \n\n"; sleep (1); // wait 1 second between literations } return 0;}void fill_random_numbers(int int_array[]) { // fill the array with random numbers for(int i=0; i<ARRAY_SIZE; i++) { int_array[i] = rand() % RANDOM_MAX; }}int count_odd_numbers(int int_array[]) { int count = 0; for(int i=0; i<ARRAY_SIZE; i++) { if (is_odd(int_array[i])) { count++; } } return count;}void display_odd_count(int int_array[]) { cout << "Number of odd numbers in the array: " << count_odd_numbers(int_array) << endl;}bool is_odd(int number) { if(number % 2 == 1) { return true; } else { return false; }}void display_sorted_array(int int_array[]) { // Sort the array of numbers sort_array(int_array); // Display the output cout << "The items in the array are: "; for(int i = 0; i < ARRAY_SIZE; i++) { cout << int_array[i] << " "; } cout << endl;}void sort_array(int int_array[]) { int index_of_min; int pass; // selective sort for(pass = 0; pass < ARRAY_SIZE; pass++) { index_of_min = pass; for(int i = pass + 1; i < ARRAY_SIZE; i++) { if(int_array[i] < int_array[pass]) { index_of_min = i; swap_integers( int_array[pass], int_array[index_of_min] ); } } }}void swap_integers(int& x, int& y) { int temp = x; x = y; y = temp;}