首页 > > 详细

PIC 10B编程辅导、c/c++程序调试、c++编程辅导辅导Python程序|调试Matlab程序

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.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!