联系方式

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

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

日期:2021-03-08 10:32

PIC 10B Homework 5 Due Wednesday, March 10

Problem 1:

Using good coding practices, design your own Linked List of int types. It will consist

of classes List, Node, and Iterator granting friendship and defining functions as needed.

Write constructors, destructors, and all necessary member functions such as insert, erase,

increment and decrement operators, operator* to dereference, as well as operator== and

operator!= to check whether two iterators are pointing to the same element. You will then

use this list to write the following member functions:

(1) List::reverse to reverse your nodes

(2) List::push front to add a value to the beginning of a list

(3) List::sort to sort the elements of a linked list (without copying them into a vector or

another data type)

(4) List::merge which accepts another List object and merges the two lists into one, alternating

elements from each list such that merging 1 7 12 and 8 3 11 2 2 1 yields the list 1

8 7 3 12 11 2 2 1.

Write a main function to test your list such that it follows the output shown in Figure 1.

Figure 1: sample output.

Due Wednesday, March 10 Homework 5 PIC 10B

Good Coding Practices:

• think about cross-platform. Don’t use Windows or Mac only commands. For example,

pause == cin.get() twice, write many \n vs. system(clear) or system(’cls).

• passing objects by reference & or const & when possible

• using field initializer list when possible in all constructors

Instructions for submission:

• Name your files exactly hw5.cpp, List.h, List.cpp, Node.h, Node.cpp, Iterator.h,

and Iterator.cpp.

• You may not use #include "stdafx.h".

• Add code description in the comment at the beginning of the file.

A sample description may look like:

/*

PIC 10B 2A, Homework 1

Purpose: Tic-tac-toe game

Date: 10/10/2019

*/

• Submit your header files and source codes to CCLE in separate files. Only .h and .cpp

files should be uploaded.


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

python代写
微信客服:codinghelp