Hey everyone,
I'm working on a project where student issues a book.
when withdrawing a book he gives data that contains his name, ID, department name and issue date. and this information is stored in a text file.
Now in return section.
first I have to match user inputs his ID and checks if this ID really exits or not.
if ID is matched he check when user issued that book. after 14 days of the day of issue, he will be fined 1000 rupees on daily basis.
after returned, that record will be deleted from the file.
Since you are just getting started and at some point the program will write to a file I would suggest this file format as it makes reading the file easier. The first fields can be read with "inFile >> variable" where "inFile" would be the name you give to your file stream. Then for the name at the end I would use "std::getline(inFile, Name)". This way if the name should grow to contain a space the "getline" would read the whole name.
If you are stuck with this file format this will work.
Another suggestion would be to read the input file into a class or struct and store this into a vector. If you are not familiar with vectors an array will work, but a vector makes it easier to delete a record.