自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(146)
  • 收藏
  • 关注

转载 C++ Primer 第 5 版 习题参考答案

从 5 月初 ~ 8 月 16 日,每天基本都在啃 C++ 的语法。起初直接看C++ Primer 中文版(第 5 版),发现后边的章节看着很吃力。所以就转而看了清华大学郑莉老师和李超老师的视频C++语言程序设计基础(自主模式)、C++语言程序设计进阶 (自主模式),看完然后(5 月底)再次开始啃前面那本书。下面是我参考一些资料书写的章节参考答案以及一些学习愚见。建议:利用C++ ...

2019-08-16 15:29:00 417

转载 第 16 章

16.1【出题思路】理解实例化的基本概念。【解答】当调用一个函数模版时,编译器会利用给定的函数实参来推断模版实参,用此实际实参代替模版参数来创建出模版的一个新的 ”实例“,也就是一个真正可以调用的函数,这个过程称为实例化。16.2【出题思路】本题练习定义和使用函数模版。【解答】代码如下所示:Compare.h#ifndef TEST_COMPARE_H#defin...

2019-08-16 14:15:00 565

转载 第 15 章

15.1【出题思路】熟悉理解虚函数、虚成员的定义。【解答】在类中被声明为 virtual 的成员,基类希望这种成员在派生类中重定义。除了构造函数外,任意非 static 成员都可以为虚成员。15.2【出题思路】区分 protected 和 private 的访问权限控制的不同之处。【解答】protected 为受保护的访问说明符。protected 成员可以被该类的成员...

2019-08-11 16:27:00 250

转载 第 14 章

14.1【出题思路】理解重载运算符与内置运算符的区别。【解答】不同点:重载操作符必须具有至少有一个 class 或枚举类型的操作数;重载操作符不保证操作数的求值顺序。例如,对 && 和 || 的重载版本不再具有 “短路求值” 的特性,两个操作数都要进行求值,而且不规定操作数的求值顺序。不同点:对于优先级和结合性及操作数的数目都不变。14.2【出...

2019-08-07 11:26:00 194

转载 第 13 章

13.1【出题思路】理解拷贝构造函数的基本概念。【解答】如果构造函数的第一个参数是自身类类型的引用,且所有其他参数(如果有的话)都有默认值,则此构造函数是拷贝构造函数。拷贝构造函数在以下几种情况下会被使用:拷贝初始化(用 = 定义变量)。将一个对象作为实参传递给非引用类型的形参。一个返回类型为非引用类型的函数返回一个对象。用花括号列表初始化一个数组中的元素或一个聚合类中...

2019-08-01 15:38:00 624

转载 第 12 章

12.1【出题思路】理解智能指针的基本特点。【解答】StrBlob b1;{ StrBlob b2 = {"a", "an", "the"}; b1 = b2; b2.push_back("about");}由于 StrBlob 的 data 成员是一个指向 string 的 vector 的 shared_ptr,因此 StrBlob 的赋值不会拷...

2019-07-19 15:52:00 205

转载 第 11 章

11.1【出题思路】理解顺序容器和关联容器的不同。【解答】学习关联容器,理解与顺序容器的不同,最关键的是理解其基础的数据结构,随后它所表现出来的一些性质就很自然能够理解了。两类容器的根本差别在于,顺序容器中的元素是 “顺序” 存储的(链表容器中的元素虽然不是在内存中 “连续” 存储的,但仍然是按 “顺序” 存储的)。理解 “顺序” 的关键,是理解容器支持的操作形式以及效率。对...

2019-07-15 15:42:00 158

转载 第 10 章

10.1【出题思路】本题练习泛型算法的简单使用。【解答】泛型算法的使用其实很简单,记住关键一点:泛型算法不会直接调用容器的操作,而是通过迭代器来访问、修改、移动元素。对于本题,将 vector 的 begin 和 end 传递给 count,并将要查找的值作为第三个参数传递给它即可。#include <iostream>#include <vector&gt...

2019-07-12 15:13:00 167

转载 第 9 章

9.1【出题思路】学习数据结构很重要的一点是清晰地掌握数据结构之上各种操作的时间复杂度,并据此分析求解问题不同算法的优劣。本题即是熟悉几种常见容器的插入、删除等基本操作的时间复杂度,并练习据此选择容器求解实际问题。【解答】(a)“按字典序插入到容器中”意味着进行插入排序操作,从而需要在容器内部频繁进行插入操作,vector 在尾部之外的位置插入和删除元素很慢,deque 在头尾之...

2019-07-08 15:47:00 127

转载 第 8 章

8.1#include <iostream>using namespace std;istream& func(istream &is){ std::string buf; while (is >> buf) std::cout << buf << std::endl; is...

2019-07-04 15:42:00 95

转载 第 7 章

7.1【出题思路】程序的思路是:只要 ISBN 相同,就不断累加销量并重新计算平均售价,直至输入新的书籍为止。【解答】满足题意的程序如下所示:Sale_data.h#ifndef TEST_SALES_DATA_H#define TEST_SALES_DATA_H// Definition of Sales_data class and related function...

2019-07-03 14:34:00 165

转载 第 6 章

6.1【出题思路】函数名、返回值、参数三者组成了函数,其中参数分为实参和形参。【解答】形参出现在函数定义的地方,形参列表可以包含 0 个、1 个或多个形参,多个形参之间以逗号分隔。形参规定了一个函数所接受数据的类型和数量。实参出现在函数调用的地方,实参的数量与形参一样多。实参的主要作用是初始化形参,并且这种初始化过程是一一对应的,即第一个实参初始化第一个形参、第二个实参初始化第...

2019-06-24 17:21:00 148

转载 第 5 章

5.1【出题思路】理解空语句的形式和用法。【解答】空语句是最简单的语句,空语句由一个单独的分号构成。如果在程序的某个地方,语法上需要一条语句但是逻辑上不需要,此时应该使用空语句,空语句什么也不做。一种常见的情况是,当循环的全部工作在条件部分就可以完成时,我们通常会用到空语句。使用空语句时最好加上注释,从而令代码的阅读者知道这条语句是有意省略内容的。5.2【出题思路】理解块...

2019-06-20 10:08:00 269

转载 第 4 章

4.1【出题思路】本题旨在考查几种常见算术运算符的优先级和结合律。【解答】在算术运算符中,乘法和除法的优先级相同,且均高于加减法的优先级。因此上式的计算结果应该是 105,在编程环境中很容易验证这一点。4.2【出题思路】C++定义了各种各样的运算符,这些运算符根据运算意义的不同被划分成不同的优先级,本题意在让用户先区分出表达式中各个运算符的优先级关系,然后用括号的方式表示哪...

2019-06-18 09:58:00 117

转载 第 3 章

3.11.9#include <iostream>using std::cout;using std::endl;// using std::cout, std::endl; // c++17 增加的特性int main() { int sum = 0, val = 50; while (val <= 100) { su...

2019-06-15 19:45:00 121

转载 c++ primer 5th(中文版)勘误

\(P_{158}\) “末位大于 3” 改为 “末位大于等于 3”\(P_{302}\)\(P_{319}\)// 添加元素用光多余容量while (ivec.size() != ivec.capacity()) ivec.push_back(0);// capacity 应该未改变,size 和 capacity 不相等... ...将注释部分 “size ...

2019-06-02 18:57:00 1072

转载 第 2 章

2.1int、long、long long 和 short 表示整型类型,C++语言规定它们表示数的范围 short \(\leq\) int \(\leq\) long \(\leq\) long long。其中,数据类型 long long 是在 C++11 中新定义的;除去布尔型和扩展的字符型之外,其它整型可以划分为带符号的(signed)和无符号的(unsigned)两种。带...

2019-06-02 18:47:00 141

转载 第 1 章

1.1prog1.cc 文件代码:int main(){ return 0;}在prog1.cc 文件所在目录下,依次执行下面命令:➜ Desktop CC prog1.cc➜ Desktop a.out➜ Desktop echo $?0注:这里prog1.cc 文件所在目录为Desktop;1.2prog1.cc 文件代码修改为:int mai...

2019-05-27 20:32:00 152

转载 c++有关构造函数、析构函数和类的组合的一个简单例子

来源链接实验四(下)代码#include <iostream>using namespace std;enum CPU_Rank {P1 = 1, P2, P3, P4, P5, P6, P7};class CPU {private: CPU_Rank rank; int frequency; float voltage;publi...

2019-04-27 21:15:00 255

转载 Lab 11-3

Analyze the malware found in Lab11-03.exe and Lab11-03.dll. Make sure that both files are in the same directory during analysis.Questions and Short AnswersWhat interesting analysis leads can y...

2019-03-05 16:02:00 240

转载 Lab 11-2

Analyze the malware found in Lab11-02.dll. Assume that a suspicious file named Lab11-02.ini was also found with this malware.Questions and Short AnswersWhat are the exports for this DLL malwar...

2019-03-03 16:01:00 231

转载 Lab 11-1

Analyze the malware found in Lab11-01.exe.Questions and Short AnswersWhat does the malware drop to disk?A: The malware extracts and drops the file msgina32.dll onto disk from a resource secti...

2019-03-02 21:42:00 92

转载 Lab 10-3

This lab includes a driver and an executable. You can run the executable from anywhere, but in order for the program to work properly, the driver must be placed in the C:\Windows\System32 directo...

2019-03-01 16:48:00 166

转载 Lab 10-2

The file for this lab is Lab10-02.exe.Questions and Short AnswersDoes this program create any files? If so, what are they?A: The program creates the file C:\WindowsSystem32Mlwx486.sys. You ...

2019-02-28 17:31:00 185

转载 Lab 10-1

This lab includes both a driver and an executable. You can run the executable from anywhere, but in order for the program to work properly, the driver must be placed in the C:\Windows\System32 di...

2019-02-27 17:24:00 274

转载 Lab 9-3

Analyze the malware found in the file Lab09-03.exe using OllyDbg and IDA Pro. This malware loads three included DLLs (DLL1.dll, DLL2.dll, and DLL3.dll) that are all built to request the same memo...

2019-02-20 16:45:00 181

转载 archlinux 装完系统连接 wifi 网络

查看 IP 地址ip a注:没有看到 IP 地址,确认没有网络。或者也可以使用命令 ping www.baidu.com 测试是否有网络。执行该指令:sudo systemctl start wpa_supplicant.service查看 Wi-Fi 列表:nmcli dev wifi list链接你的 Wi-Fi:nmcli device wifi connect "...

2019-02-07 22:37:00 29127

转载 arch Linux(二)

配置你的基本系统下列是基于该视频4:40s的流水~切换到普通用户:[root@eric-laptop ~]# su eric查看系统信息:[eric@eric-laptop root]$ neofetch -` eric@eric-laptop .o+` ...

2019-02-04 21:49:00 126

转载 arch Linux 安装完,无法通过 SSH 远程连接 root 用户问题

访问 arch Linux 主机的该文件[root@eric-laptop ~]# vim /etc/ssh/sshd_config对应注释部分后边补上下边三行:LoginGraceTime 120PermitRootLogin yesStrictModes yes修改部分的局部代码如下:#LoginGraceTime 2m#PermitRootLogin prohibi...

2019-02-04 20:37:00 1299

转载 arch Linux(一)

制作启动盘将U盘插入待装主机,设置U盘启动,重启进入系统安装界面设置root密码root@archiso~ # passwd启动允许远程连接root@archiso~ # systemctl start sshd链接无线网络root@archiso~ # wifi-menu查看待装主机的IP地址root@archiso~ # ip a拿出MacBook我们使用远程安...

2019-02-04 16:58:00 1264

转载 Lab 9-2

Analyze the malware found in the file Lab09-02.exe using OllyDbg to answer the following questions.Questions and Short AnswersWhat strings do you see statically in the binary?A: The imports a...

2019-01-24 19:44:00 97

转载 Lab 9-1

Analyze the malware found in the file Lab09-01.exe using OllyDbg and IDA Pro to answer the following questions. This malware was initially analyzed in the Chapter 3 labs using basic static and dy...

2019-01-23 17:29:00 415

转载 Lab 7-3

For this lab, we obtained the malicious executable, Lab07-03.exe, and DLL, Lab07-03.dll, prior to executing. This is important to note because the malware might change once it runs. Both files we...

2019-01-17 23:19:00 250

转载 Lab 7-2

Analyze the malware found in the file Lab07-02.exe.Questions and Short AnswersHow does this program achieve persistence?A: This program does not achieve persistence. It runs once and then exi...

2019-01-17 11:42:00 126

转载 Lab 7-1

Analyze the malware found in the file Lab07-01.exe.Questions and Short AnswersHow does this program ensure that it continues running (achieves persistence) when the computer is restarted?A: T...

2019-01-16 17:16:00 253

转载 Lab 6-4

In this lab, we’ll analyze the malware found in the file Lab06-04.exe.Questions and Short AnswersWhat is the difference between the calls made from the main method in Labs 6-3 and 6-4?A: The ...

2019-01-14 16:42:00 218

转载 Lab 6-3

In this lab, we’ll analyze the malware found in the file Lab06-03.exe.Questions and Short AnswersCompare the calls in main to Lab 6-2’s main method. What is the new function called from main?...

2019-01-14 14:51:00 219

转载 Lab 6-2

Analyze the malware found in the file Lab06-02.exe.Questions and Short AnswersWhat operation does the first subroutine called by main perform?A: The first subroutine at 0x401000 is the same a...

2019-01-13 23:14:00 241

转载 Lab 6-1

LABSThe goal of the labs for this chapter is to help you to understand the overall functionality of a program by analyzing code constructs. Each lab will guide you through discovering and analyz...

2019-01-13 20:27:00 208

转载 Lab 5-1

Analyze the malware found in the file Lab05-01.dll using only IDA Pro. The goal of this lab is to give you hands-on experience with IDA Pro. If you’ve already worked with IDA Pro, you may choose ...

2019-01-10 22:37:00 449

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除