Question: /* * Lab3.h * */ #ifndef LAB3_H_ #define LAB3_H_ #include //Declare functions void gen_arr(int n); void prt_arr(int arr[],int n); void sel_sort(int arr[],int n); int ln_search(int

/*
* Lab3.h
*
*/
#ifndef LAB3_H_
#define LAB3_H_
#include
//Declare functions
void gen_arr(int n);
void prt_arr(int arr[],int n);
void sel_sort(int arr[],int n);
int ln_search(int arr[],int n,int x);
#endif /* LAB3_H_ */
-------------------------------------------------------------------------------
/*
* Lab3_test.cpp
* NANE:
*/
#include "Lab3.h"
#include
#include
#include
using namespace std;
int main(){
//generate an array of N integers of [1,100]
int n = 10;
int arr[n];
srand(time(NULL));
for (int i = 0; i
arr[i] = rand()%100 + 1;
cout
//print the array
prt_arr(arr,n);
//conduct linear search
//first input x
int x;
cin >> x;
int result = ln_search(arr,n,x);
(result==-1)?cout
//sort the array using selection sorting
sel_sort(arr,n);
cout
prt_arr(arr,n);
}
-----------------------------------------------------------------------
/*
* Lab3.cpp
*
*/
#include "Lab3.h"
#include
using namespace std;
//Task 1
//define prt_arr here
//Task 2
//define ln_search here
//return the index where x is, otherwise return -1
//Task 3
//define sel_sort here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
