Question: In C++ Please 1. Implement the Ballroom Dancers simulation discussed on slides 26-28 in the Semaphores powerpoint. Input: ./a.out n m output.txt where n is
In C++ Please 1. Implement the Ballroom Dancers simulation discussed on slides 26-28 in the Semaphores powerpoint. Input: ./a.out n m output.txt where n is the number of "leaders" and m is the number of "followers" and output.txt is the output file generated by your program. Output: leaderdances with follower for all threads... Note, the number of leaders and followers may be different. We want to make sure all dancers dance at least once. After all have dance, the program ends. Hint: keep a running count of how many followers have danced and leaders have danced. Name your program: dance.cpp and place it in your pgm directory. If a binary semaphore is required, use a posix mutex instead.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
