In a college the faculty member wants find a student with help of their register number, now he wants to compare the register no. one by one and to find the corresponding person. Use the suitable searching technique.
string *students;
int find(string name){
int idx=-1;
for(int i=0;i<sizeof(students)/sizeof(students[0]);i++)
if(name==students[i]) idx=i;
return idx;
}
Comments
Leave a comment