自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 数据结构与算法 Chapter 3 受限线性表

3.1 栈栈(stack)又称堆栈,是一种被限定仅在表尾进行插入和删除的线性表。能进行插入和删除的一端成为栈顶(top),另一端称为栈底(bottom)。利用栈顶指针记录当前的栈顶位置。在栈顶插入称作入栈操作,在栈顶删除称作出栈操作。栈遵循“后进先出”(LIFO)与“先进后出"(FILO)原则。栈的基本操作包括创建栈、销毁栈、入栈、出栈、获得栈顶元素、栈的长度、判断栈是否为空等。3...

2019-03-09 17:01:00 231

转载 数据结构与算法 Chapter 2 线性表

2.1 线性表定义线性表是由长度为n的一组节点组成的有限序列,其中除了首末结点之外,每个结点都有直接的前驱结点和后继结点。2.2 线性表的顺序存储结构顺序存储结构使用一组连续的存储单元来存储线性表。 其特点有:线性表的逻辑顺序与物理顺序一致、数据元素之间的关系采用物理位置的相邻来表示。其可以随机存取,常用一维数组表示:#include <iostream>using...

2019-03-03 19:42:00 272

转载 Cpp Chapter 17: Input, Output, and Files Part2

17.3 Input with cinTypically, you use cin as follows:cin >> value_holder;C++ redefines >> for handling input with cin. It is overloaded for the basic types of C++, as well as the c...

2018-11-28 16:16:00 264

转载 Cpp Chapter 17: Input, Output, and Files Part1

17.1 An Overview of C++ Input and OutputUnlike other languages that place I/O in keywords, C and C++ leaves I/O purely to implementers. C++'s solution is a set of classes defined in the iostream...

2018-11-27 20:15:00 226

转载 Cpp Chapter 16: The string Class and the Standard Template Library Part2

16.4 Generic programmingA goal of generic programming is to write code that is independent of data types. The STL goes further by providing a generic representation of algorithms.) Why iterator...

2018-11-22 14:44:00 217

转载 Cpp Chapter 16: The string Class and the Standard Template Library Part1

(这已经是第二次博客园吞我东西了,有点心态爆炸)16.1 The string Class) Constructing a stringHere is a table which shows the seven form of constructors that the string class has:ConstructorDescriptionstring(...

2018-11-20 15:36:00 154

转载 Cpp Chapter 15: Friends, Exceptions, and More Part2

// 这个part因为网络问题被吞了一部分15.3 Exceptions) Calling abort()When you already know the conditions of failure, you may detect them and call abort() if true to terminate the program directly, without ev...

2018-11-17 15:30:00 84

转载 Cpp Chapter 15: Friends, Exceptions, and More Part1

15.1 Friends) When you want to make class A's private members accessible to class B, let B be a friend class of A by declaring `friend class B;':class A{public: friend class B; ...}...

2018-11-15 22:03:00 102

转载 Cpp Chapter 14: Reusing code in C++ Part2

14.4 Class Templates) Templates provide parameterized types, which is capable of passing a type name as a recipe for building a class or a function.) Changes defining a template class:1 prefac...

2018-11-15 14:25:00 138

转载 Cpp Chapter 14: Reusing code in C++ Part1

14.1 Classes with object members) The valarray classTo declare an object, you follow the identifier valarray with angle brackets that contain the desired type:valarray<int> q_values;val...

2018-11-13 23:19:00 185

转载 Python 大作业:弹球游戏

好久没更博了,最近在忙着各种期中考试在这里发一下我的python结课大作业的代码把,是一个类似于“打飞机”的弹球游戏,要在大量球的反弹中不被撞击活下来并且发射子弹攻击球,还是有点难度的hahahahaha# created by Gabriel version 1.0from tkinter import *import randomimport mathimport tki...

2018-11-06 22:31:00 1264

转载 Cpp Chapter 13: Class Inheritance Part2

Noteworthy:1 constructors of the derived class use member initializer list syntax to initialize base class private members:BrassPlus::BrassPlus(const string & s, long an, double bal, double...

2018-10-25 09:07:00 165

转载 Cpp Chapter 13: Class Inheritance Part1

class inheritance lets you derive new classes from old ones, inheriting its properties of the old class, called the base classWith inheritance, you can:1 add functionality to existing classes2...

2018-10-18 22:02:00 187

转载 Cpp Chapter 12: Classes and Dynamic Memory Allocation Part3

12.7 A queue simulation) queue: FIFO(first in first out), just like regular queue in the waiting line) stack: LIFO(last in first out), just like a pile of plates) The queue class interfacedec...

2018-10-18 09:57:00 142

转载 Cpp Chapter 12: Classes and Dynamic Memory Allocation Part2

12.3 Things to remember when using new in constructors) If you use new in constructors, use delete in destructor. Their use should be compatible, pair new with delete and new [] with delete [])...

2018-10-16 22:11:00 177

转载 Cpp Chapter 12: Classes and Dynamic Memory Allocation Part1

12.1 Dynamic memory and classes12.1.1 A review example and static class membersNow try implement a String class(a flawed one):// strngbad.h -- flawed string class definition#include <iostr...

2018-10-16 20:26:00 170

转载 Cpp Chapter 11: Working with Classes Part2

11.5.3 An implementation comment) The separation of interface from implementation is one of the goals of OOP.) Example of the implementation of the class Vector in a rand walk simulation:// ra...

2018-10-16 11:13:00 143

转载 Cpp Chapter 11: Working with Classes Part1

11.1 Operator overloading) Operator overloading is an example of C++ polymorphism. It allows you to extend operator overloading to user-defined types, to use the + symbol to add two objects.) T...

2018-10-09 11:38:00 175

转载 Cpp Chapter 10: Objects and Classes Part3

10.5 An array of objects) You can define an array of objects just as an array of built-in types:Stock mystuff[4];Declaring without initialization requires the class Stock to have default const...

2018-10-07 20:58:00 129

转载 Cpp Chapter 10: Objects and Classes Part2

10.2.4 Using classesFollowing exapmle uses the class definition and implementation written in previous files:// usestok0.cpp -- the client program// compiler with stock00.cpp#include <iost...

2018-10-07 17:48:00 181

转载 Cpp Chapter 10: Objects and Classes Part1

10.1 Procedural and object-oriented programming) In procedural programming, you first concentrate on the procedures you will follow) In OOP, you concentrate on the objects, thinking about the d...

2018-10-07 11:40:00 197

转载 Cpp Chapter 9: Memory Models and Namespaces Part4

9.3 Namespacesnamespace problemsThe conflict of using same-name things from different libraries. For example, two libraries might both define classes named List, Tree abd Node. Using them mig...

2018-10-07 09:26:00 89

转载 Cpp Chapter 9: Memory Models and Namespaces Part3

9.2.10 Storage schemes and dynamic allocationMemory allocated by new operator is called dynamic memory. Dynamic memory is controlled by new and delete operators rather than scope and linkage rul...

2018-10-05 22:50:00 97

转载 Cpp Chapter 9: Memory Models and Namespaces Part2

9.2.4 Static duration, external linkage) External variablesExternal variables are defined outside, thus external to any function.It is also termed global variables, which could be accessed in...

2018-10-05 21:12:00 101

转载 Python Chapter 10: 列表 Part3

10.10 查找列表)线性查找线性查找顺序地将关键字key与列表中的每一个元素进行比较,直到找到某个匹配元素时返回其下标,亦或在找不到时返回-1。代码如下:# The function for finding a key in a listdef linearSearch(lst, key): for i in range(len(lst)): if ...

2018-10-04 15:06:00 100

转载 Python Chapter 10: 列表 Part2

10.3 实例研究:乐透数编写程序决定输入数字是否涵盖了1-99之间的所有整数:# Create a list of 99 Boolean elements with value FalseisCovered = 99 * [False]endOfInput = Falsewhile not endOfInput: s = input("Enter a line of ...

2018-10-04 10:41:00 171

转载 Python Chapter 10: 列表 Part1

10.1 引言)Python提供一种称为列表的数据类型来存储一个有序的元素集合。Python中的列表(不像部分语言中的数组)大小可变。NUMBER_OF_ELEMENTS = 5numbers = []sum = 0for i in range(NUMBER_OF_ELEMENTS): value = eval(input("Enter a new number: "...

2018-10-04 09:31:00 161

转载 Cpp Chapter 9: Memory Models and Namespaces Part1

9.1 Separate compilation) C++ could compile multiple files separately and link them into the final executable program) You can divide original program into three parts(three files):  1. A h...

2018-09-29 22:18:00 100

转载 Cpp Chapter 8: Adventures in Functions Exercise

Exercise 3: 1 // Exercise 3 for chapter 8: by TBNR_Gabriel 2 #include <iostream> 3 #include <cstring> 4 #include <string> 5 using namespace std; 6 7 void conver...

2018-09-27 22:11:00 87

转载 Cpp Chapter 8: Adventures in Functions Part5

8.5.2 Overloaded Templates) As with ordinary overloading, overloaded templates need distinct function signatures:template <typename T>void Swap(T &a, T &b);template <...

2018-09-27 16:00:00 129

转载 Cpp Chapter 8: Adventures in Functions Part4

8.4 Function Overloading) Function overloading, also called function polymorphism, lets you use multiple functions with the same name, but using different argument lists. The key to function ov...

2018-09-27 10:39:00 98

转载 Cpp Chapter 8: Adventures in Functions Part3

8.2.6 Objects, Inheritance, and References) You might use ostream object cout and ofstream object fout(your declaration), and the object fout could share the methods of ostream class. The langu...

2018-09-25 22:16:00 105

转载 Python Chapter 9: 使用Tkinter进行GUI程序设计 Exercise

Exercise 9_1: 1 # Exercise 9.1 by TBNR_Gabriel 2 from tkinter import * 3 4 class movingBall: 5 def __init__(self): 6 window = Tk() 7 window.title("Moving Ball...

2018-09-25 16:04:00 107

转载 Python Chapter 9: 使用Tkinter进行GUI程序设计 Part 4

10. 弹出菜单 1 # Program 9.14 2 from tkinter import * 3 4 class PopupMenuDemo: 5 def __init__(self): 6 window = Tk() 7 window.title("Popup Menu Demo") 8 9 ...

2018-09-24 16:40:00 232

转载 Python Chapter 9: 使用Tkinter进行GUI程序设计 Part 3

9. 菜单使用Menu类创建菜单栏和菜单,再使用add_command方法给菜单增加条目。 1 # Program 9.13 2 from tkinter import * 3 4 class MenuDemo: 5 def __init__(self): 6 window = Tk() 7 window.ti...

2018-09-23 22:18:00 114

转载 Python Chapter 9: 使用Tkinter进行GUI程序设计 Part 2

6.几何管理器Tkinter中的几何管理器分为:网格管理器、包管理器与位置管理器(最好不要对同一容器中的小构件使用多种管理器)①网格管理器:将各个空间分布在看不见的网格中 1 # Program 9.7 2 from tkinter import * 3 4 class GridManagerDemo: 5 window = Tk() 6 ...

2018-09-23 21:39:00 136

转载 Python Chapter 9: 使用Tkinter进行GUI程序设计 Part 1

# 今天开始使用博客记录我的python学习部分笔记,从当前进度第9章开始,因教材用中文这里也用中文2. 开始使用Tkinter 1 # Program 9.1 2 from tkinter import * 3 4 window = Tk() 5 label = Label(window, text = "Welcome to Python") 6 b...

2018-09-23 20:19:00 150

转载 Cpp Chapter 8: Adventures in Functions Part2

) You can't pass an expression to a function that requires a reference:double refcube(double &ra);double x = 3.0;refcube(x); // validrefcube(x + 3.0) // invalid because x + 3.0 is n...

2018-09-23 16:53:00 80

转载 Cpp Chapter 8: Adventures in Functions Part1

//第一次在博客上发自己的C++ primer plus学习笔记,从现在进度(第8章)开始,用英文也当是练练英语写作了1. Inline Functions) When calling a regular function, the program execution will be transfered to the called function and back, thus...

2018-09-23 12:19:00 86

空空如也

空空如也

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

TA关注的人

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