n this exercise you will write a program that keeps track of who is in a certain classroom. At the start, the classroom is empty.Then for some time, students keep arriving and departing until the door finally closes.These events are given to the program as input consisting of lines of the following form
a x : This says student with roll number x arrived into the class room.
d x : This says student with roll number x departed from the class room.
c : This says the door closed.
After this you should print the roll numbers of the students who are in the class room (in increasing order), one per line and the program should stop.Arrivals and departures can happen in any order; and you can assume that a student departs only if she was present and arrives only if she was not present earlier. Assume further that the roll numbers are in the range 0 through 99. You should use a bool array present of size 100, and use the invariant: present[i] should be true if and only if student with roll number i is present in the class room.
Answers
Answered by
1
x : This says student with roll number x arrived into the class room.
d x : This says student with roll number x departed from the class room.
c : This says the door closed.
this part I don't understand
Similar questions
Science,
5 months ago
Math,
5 months ago
Math,
5 months ago
Math,
11 months ago
India Languages,
11 months ago