加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

COMP26020代做、代寫C++設計程序

時間:2023-12-08  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯


COMP26020代做、代寫C++設計程序
COMP26020 – Assignment 2
Library Management Software in C++
A. Assignment
The goal of this assignment is to implement a set of C++ classes that aim to be used in a library management
software. The library holds documents of different types (novels, comics and magazines) with various attributes
(title, author, etc.) and users can borrow and return documents.
• library.h has the different classes definitions including inheritance relationships as well as the
prototypes for all classes’ methods.
• library.cpp contains the implementations of the classes.
• test-suite.cpp, catch.h, and catch.cpp implement a test suite that checks the correctness of the
library code.
The code in your repo has everything already implemented and it’s 100% functional and (mostly) correct!
Wait. What’s the point of this assignment then?
Well, the code was written by someone who only watched some of the videos in the first week and then gave up.
As such, the code is more C than modern C++, it does not use the standard library, and it does not follow any of
the C++ design approaches. Ah, and it also has a few memory leaks. This is not good C++ code.
Your actual goal is to rewrite library.{cpp,h} using the concepts and approaches we covered in the lectures.
This includes:
• RAII
• new/delete considered harmful
• C-arrays, C-strings considered redundant
• C++ standard library containers, utilities, and algorithms
• Improved type safety
• Using linters, static analyzers, and the C++ Core Guidelines to uncover errors and bad coding patterns
Your rewrite should not change the externally visible behaviour of the library classes: any possible external
function calling any of the public member functions in library.h should behave the exact same way it did before
the rewrite. In practice this means that:
a) You are allowed to edit only library.h and library.cpp
b) You are not allowed to remove existing public member functions in library.h
c) You are not allowed to change the visibility of existing member functions
d) You are not allowed to change the argument types or the return value types of public member functions
in library.h (with one exception, see below)
e) Your member functions need to return the exact same thing they would have returned originally.
On the other hand, you are free to:
a) add new member functions (private, protected, or public)
b) change the internal implementation of any member function
c) Add/remove private member variables in library.h or change their types.
The only allowed change of types in function prototypes is between types that are implicitly convertible. For
example, an int with allowed values 0/1 can be replaced by a bool. The testing code is also designed to treat all
different kinds of strings as interchangeable. If you’re not sure, test it.
B. How to approach the assignment
As is, the code is extremely unsafe. Try to use (modern) C++ capabilities that attack that problem first. If you do it
correctly, you will be able to remove large parts of the code, eliminate some warnings, and multiple guidelines
suggestions. This will make it much easier to identify any remaining issues and understand what is causing the
various warnings.
A related advice is to keep thinking about whether you actually need every piece of code in your code base. If you
can remove some function/loop/code-block without affecting the functionality of the program, remove it.
Test your code after every single change you make. Does it still compile? Does it still pass the tests? If you made a
mistake somewhere, it’s better to find out immediately rather than after another 5-10-20 changes.
Warnings from the compiler, clang-tidy and the static analyzer are often interconnected and multiple warnings are
just symptoms of the same bad design choice. In such cases, try to eliminate the actual problem, not each
symptom individually.
C. Building and testing
Test Suite
To run and test your implementation you are given a basic test suite in the form of a C++ file, test-suite.cpp. It’s
a C++ program (i.e. it contains a main function) that includes library.h. It instantiates/manipulates objects from
all the library classes and performs sanity checks. This program uses the Catch1
test framework and requires two
additional source files to be compiled: catch.cpp and catch.h. You can compile the program manually:
$ g++ -std=c++17 test-suite.cpp library.cpp catch.cpp -o test-suite
and execute the test suite with:
$ ./test-suite
You don’t need to understand the testing code fully, but if you get failed tests, it might be useful to check the code
that is associated with the failed test in order to understand what went wrong. Overall, the suite is divided into
tests cases enclosed into TEST_CASE() { ... } statements. A test case will fail when one of the
REQUIRE( <condition> ) or CHECK( <condition> ) statements it contains fails, i.e. when condition evaluates
to false.
To complete the assignment you do not need to understand the content of catch.h and catch.cpp.
Passing all tests does not mean your code is 100% correct. Your solution is 100% correct only if the public
behaviour of all public methods remains exactly the same under all possible usage scenarios2
. When marking, we
will test whether your code is correct with a special test suite containing additional cases. So, make changes
carefully. If you are not certain about some change, add your own test case to test that change or discuss it with
us in the lab.
Make
For your convenience, we provide a Makefile that can help you automate building and testing your code.
To build the whole test suite and check the library code for warnings:
$ make
To run the gcc static analyzer
$ make analyze
1 https://github.com/catchorg/Catch2
2 You can assume that input arguments are always valid though: no null pointers, number values are within valid ranges,
filenames are legal, etc.
To run the C++ core guidelines checker and parts of the clang static analyzer:
$ make guidelines
You can change the three variables at the top of the Makefile to match your setup. CXX should point to your C++
compiler. Make sure it’s one from the last 3 years, supporting C++ 17. Also, note that make analyze will only work
with g++>=10.0. Use your compiler’s static analyzer, if you’re using another compiler. TIDY chooses which clangtidy to use. The default is to use one in the system path.
Workflow options
1. Lab workstations locally
The lab Linux workstations are already setup in the exact same way as the machine where your code will be
tested. So, it’s the easiest option to use and you will be 100% certain that if your code runs correctly for you, it will
run correctly for us too.
2. Lab workstations remotely
Same advantages as above but you can connect to them from home (through VPN) or from other university
locations. You will need an ssh client, such as openssh (Linux) or PuTTY (Windows). To connect set the remote
hostname to one in the range e-10cki18001.it.manchester.ac.uk to e-10cki18060.it.manchester.ac.uk.
For example in Linux you can do:
$ ssh -Y <username>@e-10cki18001.it.manchester.ac.uk
If the command says that it cannot find a route to the host, try a different hostname in the valid range.
3. Your own Ubuntu Installation (VM or not)
For Ubuntu 22.04 (preferred):
$ sudo apt install make g++-11 clang-tidy-12
For Ubuntu 20.04:
$ sudo apt install make g++-10 clang-tidy-12
and edit Makefile to say CXX := g++-10
With these changes you should be getting results similar to what you would get in the lab. But keep in mind that
we will not be able to help you if you run into any problems caused by differences in the setup.
4. Other systems
This is the riskiest option. We will not be able to help you with any technical issues. It’s also possible that your
system displays different behaviour than the lab workstations. For example, we have seen multiple cases where
the submission does not compile on our side because of a missing header file, but does compile on the student’s
side because their compiler indirectly included that header. So, be aware of the risks and try to test your code on a
lab workstation before submission.
The main thing to do is to install an appropriate compiler and clang-tidy. After that set CXX and TIDY in the
makefile to point to your compiler and clang-tidy respectively.
Building and running the test suite only requires a relatively modern C++ compiler so this should be easy to get
working correctly. make analyze will only work with g++ > 10.0. If you don't have access to an appropriate version,
check whether your compiler has a static analyzer you can use. make guidelines requires clang-tidy. If you're using
Visual Studio, you could use the C++ Core Check instead.
If you don't have a recent g++ or clang-tidy, consider connecting to the lab workstations and testing your code
there following the instructions above.
D. Submission
Deliverables, Submission & Deadline
There are two deliverables: the completed library.cpp and library.h files. The submission is made through
the CS Department’s Gitlab. You should have a fork of the repository named “26020-lab2-S-CPlusPlus_<your
username>”. Make sure you push to that precise repository and not another one, failure to do so may result in
the loss of some/all points. Submit your deliverables by pushing the corresponding files on the master branch and
creating a tag named lab2-submission to indicate that the submission is ready to be marked.
The deadline for this assignment is 08/12/2022 6pm UTC.
Submission Checklist
1. Does your submission compile successfully on the lab machines?
2. Does your code pass all tests?
3. Have you committed all local changes? Check using git status.
4. Have you pushed your changes to the right repository?
5. Have you tagged your latest commit with “lab2-submission”?
Marking Scheme
The exercise will be marked out of 10, using the following marking scheme:
• The program is functional, and passes the basic test suite /1
• The program passes all extended tests /1
• The code takes advantage of C++ capabilities to make the code clearer and more concise /1
• The library code follows RAII principles /1
• The library code uses Standard Library containers and data types whenever appropriate /2
• The library code uses Standard library algorithms whenever there is a clear benefit from doing so /1
• The library code does not produce significant warnings when compiled with -Wall, -Wextra, -Wpedantic,
or the static analyzer and it does not suffer from memory errors /1
• The library code follows the C++ Core Guidelines (at least the ones that we discussed in the lectures, as
well as the ones tested by clang-tidy) /1
• The code is clear, well commented, and follows good practices /1
Plagiarism/Collusion
This is an individual coursework exercise. You should not share your code with others, you should not try to see or
copy the source of anyone else, and you should not work together with other people. Exchanging ideas can also
be collusion3
 and it will definitely treated as such if the submissions are unreasonably similar.
All submissions will be checked using a standard code plagiarism detection program, as well as a checker tailored
to this assignment. We will manually examine any submissions that are flagged. If their similarities are because
they contain the code we gave you or because they applied the same obvious changes, then there will be no
further action. If this is not the case and their similarities are extremely unlikely to be due to chance, they will
either be penalised or forwarded to a disciplinary panel.
 C S Guidance UoM-wide Guidance Academic Malpractice Procedure
3 Academic Malpractice Procedure – 3.1.2.3:“The methods of collusion may include, but are not limited to, sharing of work,
ideas or plans by social media or other electronic communication means, and/or physical sharing of work, ideas or plans.”
E. FAQ (Check blackboard for updates)
0. I have the X problem on my Y laptop If you are not confident that you can fix your problems easily, just connect
to the lab workstations and work there. This is the point of lab
workstations to begin with: a single hardware/software configuration
where the code is guaranteed to run and you can be confident that we will
get the same results you get when we test your code.
1. "unrecognised command line option -
fanalyzer"
Do you have g++ > 10 installed? If you don't have g++ on your platform,
find the static analyzer of your compiler or try the g++ static
analyzer installed on the lab workstations
2. command g++-11 not found You don't have g++-11. Either install it or modify CXX in the Makefile to
point to the binary of your preferred compiler
3. Do I need make guidelines and make analyze? No, you can identify all code issues without using the two tools. But why
make your life difficult? Just use the lab workstations.
4. Do I need to eliminate all warnings from
make analyze and make guidelines?
Probably not. Some warnings might be bogus. Use your judgement. Also
suppressed warnings in make guidelines are about library code, so it's
beyond the scope of this coursework
5. If I eliminate all guideline warnings, will I get
the full mark?
Probably not. clang-tidy does not enforce all guidelines, so there will be
issues with your code that it will not complain about.
6. How will I know that I have fixed the code?
What does the perfect solution look like?
There is no way of telling you that without giving you an exhaustive list of
what you need to do. But if you attack the big problems that I kept talking
about in the lectures (i.e, "new considered harmful", RAII, "C-arrays
considered redundant", avoiding explicit bounds checking), you should
already be close to a perfect solution.
7. Can I modify the argument types of any
member functions?
Normally no. Straightforward substitutions like bool instead of an integer
that holds binary values, or std::string / std::string_view instead of cstrings are normally okay. The testing code is written in a way that it will
handle such cases gracefully. Other substitutions might change the public
interface and thus break the testing code.
If you just want to change how you use a function internally, just overload
the function with a version that has your preferred argument types.
8. "cc1plus: warning: analysis bailed out early" This only indicates that the code is too complex for the static analyzer. You
can ignore it.
9. Can I mix raw and smart pointers? Yes. Smart pointers are meant to be used only for owning data. Replacing
non-owning raw pointers with smart pointers is usually wrong.
10. Can we add a destructor for class X, even if
it was not originally declared in library.h? Can
we remove the destructor for class Y, even if
was originally declared? Can we remove a
copy/move constructor/assignment operator?
Yes, yes, and yes. The class has the set of five special methods whether
you declare them explicitly or not (unless you set them to deleted of
course). Assuming you don’t do anything that affects visibility, there is no
change to the public interface. The only change is whether the special
methods are explicit or not
11. Can we remove/modify/add private
variables?
Yes. The testing code cannot see private variables or functions, so any
changes you make cannot affect the tests.
12. The test suite reports something like:
test-suite.cpp:201: FAILED:
 REQUIRE( some_fnct() )
with expansion:
 false
REQUIRE checks whether whatever is in the following () evaluates to true
or 1. The message indicates that some_fnct() returns the wrong value. Try
to figure out why.
13. Can I change the arguments/return
values/methods to const?
Definitely not the return values. External code might depend on them
being non-const, even if they are not meant to be modified. Modifying
arguments and methods should be okay.
14. Can I change an argument from pointer to
reference?
NO! Pointers and references have similar properties but they are not
syntactically interchangeable. If I call a function passing it a pointer and
you change that function to get a reference, then the testing code will not
compile correctly.
15. When I run make guidelines I get this error:
clang-tidy: not found
The makefile cannot find the system clang-tidy. Install one.
16. Can I cut everything in library.h and paste it
in library.cpp?
NO! This will break make and modular compilation in general, i.e. your
code will not compile when tested. Also it's an awful coding practice.
17. Can we use standard library header X/Y/Z? You are allowed to use any standard library header you want, as long as
that header exists in C++ 17. It's not a great idea to use some of these
headers, but it will not break the testing code.
18. "No space left on device"! What happened? You've ran out of space. If you are using a lab machine, you don't have
unlimited space in your university's home folder. Use du -sm * from the
command line in your home folder to figure out what’s using all your
space. If you see something that you don’t need and it takes a lot of space,
delete it and try again.
19. My tagged commit did not modify library.
{cpp,h} but an earlier commit did. Will this
cause a problem?
No, it will be fine. Our code will clone your whole repo at the point in time
you tagged it, not just the files you committed when you tagged it. Out of
this clone, we will copy library.{cpp,h} into our own folder where we will
build it with our own Makefile.
E. Appendix
Class Hierarchy
The library.h header defines 5 classes which are briefly presented below. Note that more detailed information
about the methods is present in the header’s source code in the form of comments.
• Document is an abstract class defining attributes and methods common to all the documents that can be
held in the library. Attributes include the document’s title and quantity held in the library. It defines
various methods for printing the document’s information on the standard output, getting its concrete type
(novel/comic/magazine), and various getters/setters including methods for borrowing/returning the
document from/to the library.
• Novel, Comic and Magazine represent the concrete types of
documents. Each inherits from Document as depicted on the figure
on the right. They differ slightly in attributes: a novel and a comic
have an author, while comics and magazines have an issue number.
Each class also defines the relevant getters/setters.
• The last class, Library, represents the library i.e. a collection of
documents. The documents are held in an array of Document pointers. The library class defines various
methods for actions such as adding, removing, searching, borrowing, returning documents, printing the
library content on the standard output or dumping it in a CSV file.
Documents/Library Printing and CSV Output Formats
The print() method, when called on a novel, prints on the standard output the novel’s attributed in this format:
Novel, title: Monstrous Regiment, author: Terry Pratchett, quantity: 1
For a comic:
Comic, title: Watchmen, author: Alan Moore, issue: 1, quantity: 10
And for a magazine:
Magazine, title: The New Yorker, issue: 1, quantity: 20
The print() method called on a library containing these 3 documents produces:
Novel, title: Monstrous Regiment, author: Terry Pratchett, quantity: 1
Comic, title: Watchmen, author: Alan Moore, issue: 1, quantity: 10
Magazine, title: The New Yorker, issue: 1, quantity: 20
The dumpCSV() method called on the same library produces a file with the following format:
novel,Monstrous Regiment,Terry Pratchett,,1
comic,Watchmen,Alan Moore,1,10
magazine,The New Yorker,,1,20
Document class hierarchy

請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機打開當前頁
  • 上一篇:CPT109程序代做、代寫C/C++編程語言
  • 下一篇:代寫COMP3023、C/C++語言編程代做
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    亚洲特色特黄| 欧美日本不卡| 欧美日韩激情在线一区二区三区| 日本美女一区二区三区| 香蕉久久a毛片| 大色综合视频网站在线播放| 久久婷婷国产| 亚洲成人va| 美女精品在线| 国产在线不卡| 荡女精品导航| 国产探花一区二区| 国产精品久久国产愉拍| 蜜桃久久精品一区二区| 不卡中文一二三区| 在线日韩成人| 国产一区二区三区电影在线观看 | 激情不卡一区二区三区视频在线| 久久91超碰青草在哪里看| 石原莉奈一区二区三区在线观看| 成人久久久久| 亚洲国产欧美在线观看| 国产一区二区三区91| 亚洲日韩视频| 欧美激情三区| 蜜桃精品在线| 美女福利一区二区三区| 久久99伊人| 最新日韩欧美| 亚洲五月婷婷| 青青一区二区| 精品国产乱子伦一区二区| 亚洲警察之高压线| 国产成人一区| 欧美精品福利| 日本午夜一本久久久综合| 成人在线高清| 日韩欧美一区二区三区免费看| 首页综合国产亚洲丝袜| 午夜在线精品| 久久国产88| 亚洲欧美bt| 午夜影院日韩| 亚洲主播在线| 久久成人免费| 久久福利影视| 先锋影音久久| 老牛国产精品一区的观看方式| 红桃视频国产精品| 日韩视频中文| 国产视频亚洲| 老司机午夜精品视频在线观看| 亚洲黄页一区| 亚洲欧美清纯在线制服| 99国内精品| 免费在线观看不卡| 欧美好骚综合网| 亚洲精品福利电影| 久久99久久99精品免观看软件| 日本在线高清| 日韩一区欧美| 日韩成人综合网| 中文精品久久| 天海翼亚洲一区二区三区| 精品视频在线观看网站| 伊人久久亚洲| 91精品尤物| 999国产精品| 黑人一区二区三区四区五区| 99香蕉国产精品偷在线观看 | 9l亚洲国产成人精品一区二三| 99亚洲乱人伦aⅴ精品| 精品国产网站| 欧美日韩三级电影在线| 美女精品在线观看| 日韩欧美高清在线播放| 久久精品女人| 国产免费播放一区二区| 精品国产鲁一鲁****| 久久久水蜜桃av免费网站| 午夜久久久久| 色婷婷亚洲mv天堂mv在影片| 国产麻豆久久| 亚洲一区在线| 日韩免费精品| 欧美在线色图| 麻豆成人在线| 岛国精品在线| 成人在线视频www| 伊人精品综合| 精品中文一区| 黑森林国产精品av| 日日骚欧美日韩| 日韩极品在线| 999久久久91| 成人一区不卡| 日韩精品午夜视频| 日韩成人视屏| 亚洲精品网址| 日韩欧美1区| 91视频亚洲| 清纯唯美亚洲经典中文字幕| 国产农村妇女精品一区二区| 精品成人免费一区二区在线播放| 欧美日韩一卡| 清纯唯美亚洲经典中文字幕| 老司机午夜精品视频| 国产日韩亚洲| 国产主播性色av福利精品一区| 尤物在线精品| 国产精品美女午夜爽爽| 日本三级久久| 99热这里只有精品8| 日韩毛片一区| 日韩av一区二区三区四区| 亚洲激情女人| 国产精品亚洲欧美| 成人爽a毛片| 视频一区欧美精品| 欧美激情五月| 久久天堂精品| 精精国产xxx在线视频app| 国模大尺度视频一区二区| 亚洲午夜极品| 51一区二区三区| 亚洲2区在线| 蜜臀精品久久久久久蜜臀| 91成人app| 五月天久久久| 麻豆成人91精品二区三区| 精品丝袜久久| 在线观看精品| 96sao在线精品免费视频| 欧美在线综合| 国产欧美欧美| 亚洲欧美视频| 综合久久av| 一本久久综合| 日本成人中文字幕| 不卡在线一区二区| 日韩国产在线观看一区| 激情久久一区| 国产日韩一区| 亚欧美无遮挡hd高清在线视频| 久久这里有精品15一区二区三区| 成人婷婷网色偷偷亚洲男人的天堂| 日本黄色免费在线| 精品国产三区在线| 日韩在线高清| 欧美色图婷婷| 国产欧美日韩一级| 尤物tv在线精品| 国语精品一区| 亚洲深夜福利| 国产一区二区三区电影在线观看 | 日韩天天综合| 中文字幕成人| 蜜桃伊人久久| 日韩欧美久久| 99亚洲伊人久久精品影院| 99精品美女| 麻豆精品视频在线观看免费| 一本一本久久| 欧美女王vk| 日本免费一区二区三区四区| 成人综合久久| 国产欧美午夜| 亚洲综合国产| 91精品日本| 国产精品一二| 久久大逼视频| ccyy激情综合| 麻豆精品一二三| 免费成人在线观看视频| 黑色丝袜福利片av久久| 色婷婷成人网| 亚洲尤物精选| 91欧美日韩在线| 日本午夜精品一区二区三区电影 | 日韩欧美综合| 国产一区二区中文| 国产影视精品一区二区三区| caoporn视频在线| 欧美日中文字幕| 国产va免费精品观看精品视频| 黄视频网站在线观看| 日本精品影院| 国产欧美日韩在线一区二区| 中文字幕色婷婷在线视频 | 国产农村妇女精品一区二区| 日韩精品一区二区三区免费视频| 欧美日韩国产网站| 中文日韩欧美| 精品久久精品| 国产午夜精品一区在线观看| 欧美日韩视频免费观看| 蜜桃精品噜噜噜成人av| 精品成人18| 最新国产精品| 在线一区视频观看|