hi, I am doing a linear search in my C++ program. Bascially i have a list of students and i should be able to search by student name. I did write a Linear Search code, as below. I am not able to run it correctly !!! Any help would be appreciated...
Thanks in Advance...
// Variables
int read_array (string StudentNameArray[],int StudentId[],float StudentGpa[]);
void sort_array (string StudentNameArray[], int StudentId[], float StudentGpa[]);
Question
punjboy
hi, I am doing a linear search in my C++ program. Bascially i have a list of students and i should be able to search by student name. I did write a Linear Search code, as below. I am not able to run it correctly !!! Any help would be appreciated...
Thanks in Advance...
// Variables
int read_array (string StudentNameArray[],int StudentId[],float StudentGpa[]);
void sort_array (string StudentNameArray[], int StudentId[], float StudentGpa[]);
/*******************************************************************
Searching Array
Linear search
********************************************************************/
int i;
string s;
for (i = 0 ; i != s ; i++) // Searching Using Student Name
{
{
if ( StudentNameArray == s)
pos = i
};
if (pos > -1);
{
cout << 'Find Student' << pos;
}
else
cout << 'Not Found' ;
}
Link to comment
Share on other sites
9 answers to this question
Recommended Posts