void search_profile()
{
system("cls");
int id;
int counter=0;
string read_line;
cout<<"SEARCHING A PATIENT PROFILE: \n";
cout<<"Enter User id: ";
cin>>id;
ifstream file;
file.open("Patients.txt");
while(!file.eof())
{
getline(file, read_line);
counter++;
if(read_line.find(id)!=string::npos)
{
cout<<"Data found at line: "<<counter<<endl;
cout<<read_line<<endl;
break;
}
}
file.close();
}
each line of the file has a unique id that i want to do the search based on that id, if the id is found the total line to be displayed. but this function only works well with the first line, so if i search something in the second or other lines it will not find them.