I am having some issues with my case for the code. The purpose of this case is that, the user enters a number of hours and the if the hours worked by the employee is less than the hours entered by the user, it will be read from a data file and displayed. Now, if the data file has no hours worked less than hours specified by the user, it will show cout << "NO RECORDS FOUND!\n";. When i do a test run, it shows no record found, more than 1 time. How can i get out of the counter. I tried to do this with if else logic.
not entirely sure what you are asking, but … hoursworked < hours will fail if they are equal. From what I see, I would expect them to BE equal, but I dunno exactly what you want it to DO.
also, the IF is part of the while, and so is the else, so yes it will do it multiple times. Did you mean to put a ; on that while loop and do the if one time?
I am trying to look through a data file and display all the records for people whose hours worked is less than the hours user is asked to enter.
The only problem i am having is that.
if i enter 2, when asked to put in hours. NO RECORDS FOUND is written to terminal many times. What can i do, so it is only written one time.