How to search for a string and print it's related details in c++ : I'm trying to compare an inputed string to a returned string while looping through a file and if the inputed string is equal to the returned string from the file it prints the details associated with the file but it keeps giving me the error message invalid use of void expression...

	


> void search_course(string course){ 	int check=0; 	student st;
> 	ifstream file;
>     file.open("student.dat",ios::binary|ios::out); 	if(!file) 	{ 		cout<<"No Such file in Database..."; 		return; 	} 	while(!file.eof()
> && check==0) 	{ 		file.read((char *) &st, sizeof(student));
> 		if(strcmp(st.return_prog(), course) == 0) 		{ 			st.showid_detail();
>         }
>     }
>     file.close(); } int main(){
>         system("CLS"); 	string course="physics"; 	search_course(course); return 0; }




The showid_detail() is a function in a class which displays information about a record as follows....id, index, name, course, year, Hall
return_prog() is a void function that outputs a course of a student
I expected the code to display all those students doing physics, but it kept telling me invalid use of void expression...