CS110 Programming 1 Lab 1 CS110 Passing Arrays as Function Arguments 2 CS110 Passing Arrays as Function Arguments Example: #include <iostream> using namespace std; void show(int arr[3]) { for (int i=0; i<3; i++) cout << arr[i] <<endl; } int main () { int test[] = {5, 10, 15}; show(test); } 3 CS110 SORTING ARRAYS What Sorting Means? Arranging array elements in some order(ascending/descending) is called as sorting. 4 CS110 Selection Sort Selection sort There are many ways to sort an array. Selection sort is the easiest sort to understand. 5 CS110 Question Write a complete C++ Program that has an array named by array5 which store five integer numbers: 8, 5, 10, 4, 2. Your program should sort array elements in Descending order and show them before and after sorting. 6 CS110