Arrays: Introduction To Computing Lab-XII
Arrays: Introduction To Computing Lab-XII
Arrays: Introduction To Computing Lab-XII
Lab-XII
Arrays
Task 01: Write a C++ program that declares an array of 10 indexes. The program asks the user to choose
one of the initialization methods given in the following
Task 03: Write a C++ program that is able to find the maximum value from an integer array of 10
Task 04: Write a C++ program that creates an array of 6 indices. The program initializes the indices like
{100, 101, 102, 103, 104, 105}. The program than swaps the value at first index with the value at last
index, value at second index with the value at second last index, and the value at third index with the
value at third last index. For an example, see the following
Initial array
Task 05: Create two array called Array1 and Array2. Initialize Array1 with some random numbers.
Array2 is blank and same as size of Array1. Write a program that takes Array1 and Array2 and store
Values of Array1 in Array2 but in reverse order
Array1[10]= {2,4,5,66,75,8,53,11,3,45}
Array2[10]= { , , , , , , , , , }
Output:
Array1= {2,4,5,66,75,8,53,11,3,45}
Array2={45,3,11,53,8,75,66,5,4,2}
Task 06: Create an integer array of Size 10 and initialize it with some random numbers. Take an input
from user and create a function called finds that finds entered number into array and return index. It
returns -1 if number does not found.
Sample 1
Array[10]= {2,4,5,66,75,8,53,11,3,45}
Output:
Enter a number: 66
Index of number is: 3
Sample 2
Array[10]= {2,4,5,66,75,8,53,11,3,45}
Output:
Enter a number: 100
Number is not present