14/02/2014
Write a C++ program containing three functions namely product_array, mult and search. Your program should take three inputs (1, 2 and 3). If user enters 1; function one is called, function two if 2 is pressed and function three if 3 is entered (Make sure program asks for a valid input if an invalid number is inputted).
Function 1 calculates product array. i.e. for an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all the elements of arr[] except arr[i].
Example:
arr[] = {10, 3, 5, 6, 2}
prod[] = {180, 600, 360, 300, 900}
Function 2 multiplies array A and B of order NxL and LxM (Matrix Multiplication).
Function 3 searches a particular element in an array. The size of the array and elements in the array are to be inputted by user. Further, the user shall enter a key. You need to traverse the whole data elements from start to end one by one to find key comparing with each data element to the key. There can be two possible outcomes if we are assuming that our data contains unique values.
1) Search successful Key Found means in array at an index we found value which matches to our key
2) Search failed to find the Key mean our key does not exist in data