
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

It is considered that you have completed the last lab Task‐ 01 Write a function sort(int arr[],int size);, the function should have two parameters 1)an integer array 2) size of the array passed. The function will sort the array in ascending order. Write a program that takes 10 integer values from user and stores them in an integer array, the array is passed to sort() function and the sorted array should be displayed. Extension Modify the sort function, and use only one parameter i.e. int arr[], for size of the array use sizeof operator. Task‐ 02 Write a simple program that declares and initializes a character array of 10 elements. (Use initialize list i.e. single quote values). Display the values stored in array by using a for loop. Change the program and initialize the array with a string, use a for loop to display the values of the array. Change the program and initialize the array with your name as initialize list, display the values stored in the array in reverse order. Change the program and initialize the array with a string (your name), display the string in reverse order. Extension Write a function reverse() that has two parameter 1) a character array 2) size of the array. The function processes the array passed and reverses it. Write a program to demonstrate the working your function reverse(). Extension Overload the function reverse() so that it can reverse an array of integers or floats or characters. Write a program to demonstrate the working of your overloaded reverse() function Task‐ 03 Write a function vowel() that takes two parameters 1) a character array 2)size of the array. The function should return the number of vowels in the array passed. Write a program to demonstrate the working of your function Change the function and pass a third parameter ch of type character, the function should count and return the instances of ch in the array. see the example below char name[]=”Pakistan”; cout<<vowel(name,9,’a’) ; Output: 2 Task‐ 04 Write a function intCopy(int arrA[],int arrB[].int sizeA,int sizeB). The function takes two integer arrays along with their sizes, the function copies the contents of arrA[] into arrB[], write a program to demonstrate the working of the function. Change the program and write intCopy with only two parameters i.e. arrA[] and arrB[] (use s izeof operator) Change the program and write a new function strCopy() that takes two character arrays and copy the contents of first array into second Extension Write a generic overloaded function copy() that can copy contents of first array into second regard less of type of the array passed