• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • Hello World!

    Beautiful World, Wonderful Life.

  • Change the World by Program.

  • A language that doesn't affect the way you think about programming, is not worth knowing.

    Alan J. Perlis

  • Mosher's Law of Software Engineering

    Don't worry if it doesn't work right.
    If everything did, you'd be out of a job.

  • Any code of your own that you haven't looked at for six or more months might as well have been written by someone else. (Eagleson's law)
  • Stewart Brand

    Once a new technology starts rolling, if you're
    not part of the steamroller, you're part of the road.

  • Bjarne Stroustrup

    There are only two kinds of programming languages:
    those people always bitch about and those nobody uses.

  • Nine women can't make a baby in one month.

  • Within a computer,
    natural language is unnatural.

  • If you're the smartest person in the room, then

    you're in the wrong room.

  • Without requirements or design,
    programming is the art of adding bugs to an empty text file.

    --Louis Srygley

  • Fools ignore complexity.
    Pragmatists suffer it.
    Some can avoid it.
    Geniuses remove it.

C++ Programming and Object-Oriented Design

Project 14. Queue Application System


Click to Download the Executable Files.       Click to Download the Sources Files. (Password Needed)


Name: Queue Application System
Copyright: Seng Dewen
Author: Seng Dewen
Date: Oct. 1, 2020
Description: Queue Application System.

菜单(Press 0 for English Menu)


1. Create Queue(创建队列)

2. Show Queue(显示队列)

3. Enqueue(入队列)

4. Dequeue(出队列)

5. Clear Queue(清空队列)

6. Get Head(获取队头元素)

7. Import to File(从文件导入)

8. Export to File(导出到文件)

9. Partner Problem(舞伴问题)

At the dance hall, boys (M) and girls (N) line up in a line when they enter the ballroom. At the beginning of the dance, one person from the top of the boys' team and one from the girls' team will be assigned as partners. Unpaired people will wait for the next round of dance music. Now it is required to write an algorithm to simulate the above-mentioned dance partner problem. Assuming that a total of k songs will been danced, find the matching status of boys and girls in each song.

Enter a number t to display:

(1). The matching situation of the t-th song;

(2). All dancing partners of the t-th boy;

(3). All dancing partners of the t-th girl.

10. Game Problem(运动会问题)

Suppose that there are N sports in Olympic Game, and each athlete can take part in 1 to 3 sports. How to arrange the competition schedule that:

(1). Sports involving the same athlete are not scheduled to take place on the same day.

(2). Make the overall competition days the minimum.

11. Train Carriage Problem(火车车厢问题)

A freight train has N carriages, each of which will be parked at a different station. It is assumed that the serial numbers of N stations (from far to near) are 1-N in order, that is, freight trains pass through these stations in the order from the N-th station to the first station.

In order to facilitate the removal of the respective carriages from the train, the carriages should be arranged the same as those of the stations so that the carriages are in order from front to back, arranged 1 to N, so that only the last carriage is removed at each station.

The Brain Carriages arrive at the station at different times, so they need to be rearranged by using the Buffer Tracks, and then get out in the order of 1-N. Assuming that the amount of Buffer Track is K, it can be judged whether the train carriages arriving at the station can be rearranged successfully or not.

For example:

Suppose there are 3 Buffer Tracks, and the order of arrival of the cars is: 3,6,9,2,4,7,1,8,5, then the order of 1-N rearrangement can be completed.

If the order of arrival of the cars is: 3,6,9,2,4,7,5,8,1, then it is impossible to complete the order of 1-N rearrangement.

12. Exit(退出程序)




Back to Top