Menu

[Solved]Activity Required Provide Files Called Lincpp Well Makefile Compile Run File Lincpp Skele Q37274972

For this activity, you are required to provide files calledlin.cpp as well as a makefile to compile and run it. In your file,lin.cpp, should have a skeleton of a main program as per normalwhich you will then fill it in as per the following.The objective of this activity is to demonstrate the linearsearch algorithm for arrays. You are going to implement this as afunction with the following definition:string linSearch(double arr[10], double search[7]);This function will represent the core functionality of yourprogram. This function will take two arrays as arguments, both ofspecified size. The first array will be the array that should besearched. It will contain double values. The second array willrepresent a list of values to search for in the first array.Your function will return a string, comma-delimited, whichrepresents the indices of the searched for elements in the array.The first index in the string should correspond to the firstelement in the search array and so on. If the array is not found,it should show NA. For example:Consider the case ofarr={1.1,1.2.1.3,1.4,1.5,1.6,1.7,1.8.1.9,1.11}and search={1.3,2.1,1.11}
Then the return value of linSearch should be: 2,NA,9
The search array will be of size 7, the above example is justto demonstrate what sort of results should be expected. Onceimplemented, the rest of your main program should be as follows.Read in from a file called search.txt. In this file, the first linewill be a comma delimited list of double values, corresponding toarr. The second line will contain
a comma delimited list of values to search for. The outputshould display each value (of the search results) on a newline.
You will have a maximum of 10 uploads for this task. Thestring, sstream and fstream library will be useful here. Be sure toinclude a blank search.txt in your submission.

Expert Answer


Answer to For this activity, you are required to provide files called lin.cpp as well as a makefile to compile and run it. In your… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *