I have a task where I have to simulate a parking garage in C++ using stack. There is only one entrance/exit to the garage. If someone comes to retrieve a car that is not first out of exit, all cars blocking its path must be moved out (hence the stack). After the car is taken out, all other cars are restored in order they were taking out.

I am provided with an input file which should be read in my program. Each line of the input file contains an "A" for arrival or "D" for departure, a license plate number (6 characters) and the time of arrival or departure.

ie. ACDA98310:30AM
DCDA983 2:15PM
........

My first question about this program is:

I am not very familiar with reading in files of this type, so the program will have to know how to filter each part of the input. How do I do that?

Also, will I have to use 2 stacks? 1 for the main garage, and another as a temporary stack to store the cars when I am popping them out of garage to allow for a departure?

Could someone please help point me in the right direction? thank you