Dancing Partner Matching(Queue)[Solution introduction: the second video in 3.6] [Problem description] In a ball, when gentlemen and ladies come, they form a queue of gentlemen and a queue of ladies, respectively. When the ball starts, the gentlemen and ladies who come first should get partners first. A gentleman should be matched with a lady. Similarly, a lady can only match with a gentleman. Write programs to simulate the process of dancing partner matching. The maximal number of coming gentlemen or ladies is 30. [Basic requirements] 1) Use queues to solve this problem. [Example]Problem: Match coming gentlemen and ladies. What you need to show in the terminal(the back part is outputted by you and the blue part is inputted by the user, i.e., teacher): Please input coming dancers: Mark, male, 19 Alice, female, 21 Jenny, female, 23 Bob, male, 20 Andrew,male, 19 Julian, female, 18 Ivan, male, 22 Jeff, male, 21 Dancer partners are: Mark, Alice Bob, Jenny Andrew, Julian The following dancers do not have partners: Ivan, male, 22 Jeff, male, 21
The requirements of reports:
1.The
2.The source code with necessary comments
3.Test case and results (show the screenshot of your terminal);
4.Summary
4、Dancing Partner Matching(Queue)[Solution introduction: the second
video in 3.6]
[Problem description]
In a ball, when gentlemen and ladies come, they form a queue of gentlemen
and a queue of ladies, respectively. When the ball starts, the gentlemen and
ladies who come first should get partners first. A gentleman should be matched
with a lady. Similarly, a lady can only match with a gentleman. Write programs
to simulate the process of dancing partner matching.
The maximal number of coming gentlemen or ladies is 30.
[Basic requirements]
1) Use queues to solve this problem.
[Example]Problem: Match coming gentlemen and ladies.
What you need to show in the terminal(the back part is outputted by you
and the blue part is inputted by the user, i.e., teacher):
Please input coming dancers:
Mark, male, 19
Alice, female, 21
Jenny, female, 23
Bob, male, 20
Andrew,male, 19
Julian, female, 18
Ivan, male, 22
Jeff, male, 21
Dancer partners are:
Mark, Alice
Bob, Jenny
Andrew, Julian
The following dancers do not have partners:
Ivan, male, 22
Jeff, male, 21
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)