联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-02-04 08:39

Homework 7

The goal of this homework is get you familiar with C++ Templates.

You need to use C++ template to implement a Queue class using C++ vectors so that your

queue class can store data of any type. Since you use C++ vectors, you will not need to

specify queue sizes. Your class should provide at least the following functions:

(1) top(), which returns the top of the queue;

(2) pop(), which returns the top of the queue and also remove it from the queue;

(3) push(), which inserts an element into the end of the queue;

(4) empty(), which returns whether the queue is empty.

Your main function needs to do the following:

(1) Instantiate a queue of integers; push integers 1, 2, 3, 4, 5, and 6 into the queue one by

one, then pop all of them out and print out each number that you pop (which will be in the

order of 1, 2, 3, 4, 5, and 6.

(2) Instantiate a queue of doubles; push doubles 0.1, 0.2, 0.3, 0.4, 0.5, and 0.6 into the queue

one by one, then pop all of them out and print out each number that you pop (which will be in

the order of 0.1, 0.2, 0.3, 0.4, 0.5, and 0.6.

Due: February 5

th, 11:59PM, 2019.

Turn in one file via handin: the zip file of your whole NetBean directory. The name of your file

should be: LastName_FirstName.zip. For example, if your name is John Smith, you should

turn in one files: Smith_John.zip.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp