Need help with Functions please

I need to write the functions for this, but I can't seem to do it. I've spent way too long trying it, I know I've strayed away from the right track. Any help/explanation would be appreciated (just starting C++)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <ctime>
using namespace std;
//This program will load an integer array with random numbers
//and ask the user for a number to search for 
//Will tell the user if the number is found or not


bool findIt(int* start, int* end, int value);
   // look for the value starting at start and going to end
   // return true if found else false

void randomizeIt(int* start, int length, int MaxNumber);
   
   

int main(){
	//define variables
	bool keepGoing = true;
	const int arraySize = 10;
	const int bigNumber = 100;
	int myArray[arraySize];
	int userValue = -1;			

	srand(time(0));				
	do{							
		if(userValue == -1)		
			randomizeIt(myArray, arraySize, bigNumber);
		cout << "Enter number between 1 and " << bigNumber
			 << "to search for (0=quit, -1=randomize array ";
		cin  >> userValue;		
		if(userValue > 0){		
			if(findIt(myArray, &myArray[arraySize-1], userValue))
				cout << "Found " << userValue << endl;
			else
				cout << userValue << " not found" << endl;
		}else{
			if(userValue == 0) keepGoing = false;
		}
	}while(keepGoing);			
	return 0;
}
Topic archived. No new replies allowed.