Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DO it in C++. Do as question asked. 4, Dancing Partner Matching(Queue)[Solution introduction: the second video in 3.6] [Problem description] In a ball, when gentlemen
DO it in C++. Do as question asked.
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started