I have this sample code that my instructor gave so I can be able to create a program similar for extra points
Code:
#include<stdio.h>
/*Put the Prototype here */
#define NUMINTS 10
int main(void)
{ int values[NUMINTS]={5,10,30,42,18,24,50,88,62,99};
int skey=0,n,index;
printf("\nEnter Search Key ID or -1 to terminate: ");
scanf("%i",&skey);
while(skey!=-1)
{ if ((index=seqsearch(values,NUMINTS,skey))==-1)
printf("\nNo match found for: %i \n",skey);
else
printf("\nValue: %i found at index %i\n", skey,index);
printf("\nEnter Search Key ID or -1 to terminate: ");
scanf("%i",&skey);
}
puts("\nGOODBYE\n");
return 0;
} //END MAIN Function definitions come next
Now I am not sure what is wrong with it but i get 2 errors and I been trying to fix it.
Error 1 error LNK2019: unresolved external symbol _seqsearch referenced in function _main Array.obj
Error 2 fatal error LNK1120: 1 unresolved externals F:\Csci 180\Assignment5\Debug\Assignment5.exe
This program will help with my extra pt assignment:
Write a program which performs the following actions:
1) Generates an array with 100 integers with random values between 1 and 1000.
2) Sort the array (using either selection sort or bubble sort)
3) print the sorted array
4) Ask the user for a number to search for
5) Search the array with binary search.
6) Indicate whether or not the value was found.
7) repeat steps 4-6 until the user enters -1 for the search value