C++代写 代写C++程序 C++作业代写 C++程序代写

"C++数据结构代写" CPP数据结构代写

Abstract Data Type Assignment

Your task for this assignment is to create two different classes that implement the Stack ADT in Stack.h. Important: don't change Stack.h in any way!

1. Call one of your implementation classes Vec_stack , and implement it using a vector . adt_vec.cpp gives a starting template. Don't #include any other files.

Make sure Vec_stack has a default constructor that makes an empty stack.

In the main function, add automated testing that tests every method in Vec_stack . Do enough testing to ensure that your implementation

is correct.

Source code readability matters! We want to see perfect indentation and use of whitespace, sensibly chosen names, good use of appropriate C++ features, and so on. Please follow coding style used in the notes and lectures.

2. Call your other implementation List_stack , and implement it using a linked list that you create by hand. adt_list.cpp gives a starting template. Don't #include any other files.

List_stack should have a default constructor that makes an empty stack.

In the main function, add automated testing that tests every method in List_stack . Do enough testing to ensure that your

implementation is correct.

Source code readability matters! We want to see perfect indentation and use of whitespace, sensibly chosen names, good use of appropriate C++ features, and so on. Please follow coding style used in the notes and lectures.

3. Suppose you want to create function that tests if two stacks are the same (i.e. have the elements in the same order) using a function with this header:

Is it possible to implement this operator== without changing the types of its parameters? If so, give an implementation of operator== that works correctly. If not, explain exactly how you would modify Stack to make this work efficiently.


bool operator==(const Stack& a, const Stack& b)

Write your answer for this question in a text file named equality.txt. Spelling, grammar, and formatting matter!

京ICP备2025144562号-1
微信
程序代写,编程代写
使用微信扫一扫关注
在线客服
欢迎在线资讯
联系时间: 全天