#### Archived

This topic is now archived and is closed to further replies.

This topic is 6139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok I HAVE to make a program that 1.Makes 100 random numbers 2.Make sure none of the random numbers equal the any other number 3.Ask a user for 3 numbers, between certain numbers 4.Make sure none of the asked numbers are the same as the randome numbers 5. Do 2 kinds of searches (linear, binary) 6. Get the time taken to get the numbers using either the linear or the binary searches. The problem is i dont no how to do linear, or binary searches. Nor do I know how to sort or use pointers that good. I have to do this by tuesday, for my ap computer science class, but for the past year instead of learning c++ i learned java, and now all of a sudden i have to do this. Here is the source i already have, but it has errors, and i still have to make a function to get the time, and a binary search function. I have like 10 errors, and i dont no how toget rid of them, Please HELP!!
 ` #include #include #include #define size 100; void seq(); //void binary(); void sort(*array) { int min, randnum[100]; int x,i,j,front,back,middle,num1,num2,num3,ele; //get three numbers to be found. cout <<"Please enter a number between 1 - 33: "; cin>>num1; cout <<"\n\nPlease enter a number between 34-66: "; cin>>num2; cout <<"\n\nPleae enter a number between 67-100: "; cin>>num3; for(i=1; i<=size; i++) { //set 3 elements to numbers from the user front = num1; middle = num2; back = num3; //set the numbers in the randnum[i] places randnum[rand() % i] = front; randnum[rand() % i] = middle; randum[rand() % i] = back; //get 100 random numbers (between 1 - 100) srand((unsigned)time(NULL)); randnum[i] = rand() % 100; //check if any number is the same if(randnum[i] = size - 1 || randnum[i] = front || randnum[i] = middle || randnum[i] = back) { do { //if any number is the same set the same elements to randomize again randnum[i] = ele; ele = rand() % 100; } while(randnum[i] = size - 1 || randnum[i] = front || randnum[i] = middle || randnum[i] = back) } cout <

##### Share on other sites
as this is the absolutely most obvious homework question i have ever seen here to date, the only advice i can give you is to read your textbook and/or class notes.

--- krez (krezisback@aol.com)

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013607
×