ELET 2300: Introduction to C++ Programming Fall 2020 Lab 3 Deadline: Sa. November 28, 11:00 PM Please work on the following labs and submit your solutions on a single .txt file 1. Declare an integer...

attached below


ELET 2300: Introduction to C++ Programming Fall 2020 Lab 3 Deadline: Sa. November 28, 11:00 PM Please work on the following labs and submit your solutions on a single .txt file 1. Declare an integer array having 10 elements. Populate the array using the rand() function. Accept a number from the user and rotate the elements of the array by the said number. e.g. a.) array = [3, 4, 5, 1, 2, 8, 6, 7, 0, 9] number = 3 Output = [7, 0, 9, 3, 4, 5, 1, 2, 8, 6] b.) array = [3, 4, 5, 1, 2, 8, 6, 7, 0, 9] number = 12 Output = [0, 9, 3, 4, 5, 1, 2, 8, 6, 7] 2. Declare an array having 10 integers in ascending order. Create a function to reverse the order of the elements. Use pass by pointer to change the order of the original array in the main function. 3. Write a program to demonstrate passing a pointer to a function as a parameter to another function. Create 3 functions printMessage1, printMessage2 and displayMessage. Function printMessage1() prints “Hello! How are you?” and function printMessage2() prints “Have a good day!”. Call the displayMessage function in the main function and pass the pointers to printMessage1() and printMessage2() to display the respective messages.
Nov 28, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here