Can anyone help me figure out the my C++ homework

Hello, I am a new member in this forum. But , I need somebody help me do my C++ homework. It is due on Monday, tomorrow.
I am not sure what my professor talks about. Can everyone help me ? Please see below. Thank you those people who help me, I appreciate them .





Modify main() to generate ten values of d randomly in a for loop. d should be between 0 and 49.


/*
* TestSrch.cpp
*
* Created on: Nov 7, 2012
* Author: Sam
*/

#include <iostream>
using namespace std;

int linearSearch(int , int );
void testSrch(int, int );
int a[14]={3,7,4,2,11,43,79,15,20,7,11,13,4,40};// global array a
int main(){
int d = 13,aLength = 14;
testSrch(d,aLength);
d=33;
testSrch(d,aLength);
system("PAUSE");
return 0;
}
void testSrch(int d, int aLength){
int srchResult;
srchResult=linearSearch(d,aLength);
if (srchResult<aLength)
{ cout<<"Value "<<d;
cout<<"\nIs at array element "<<srchResult<<endl<<endl;
}
else
cout<<"there is no match for search argument:"<<d<<endl;
}
int linearSearch(int v, int len){
//precondition: array a is a global array of length len, that has already been filled.
//v is the search argument.
//postcondition: returns the position of the first occurrence of search arg.v
//in array a. if no match, returns n.
int aSub=0;
for(;aSub<len ;aSub++){

if(a[aSub] == v){
break;
}
}
return aSub;
}
Topic archived. No new replies allowed.