C + + smart pointer shared_ptr

Pointer C + + provides the method of pointer operation. When we open up the space of the specified type with new, a pointer is generated. void use_pointer() { //An integer pointer to an element with a value of 5 int *pint = new int(5); //A pointer to a string string *pstr = new string("hello zack"); } The pointer object can be ...

Posted by kinaski on Tue, 18 Jan 2022 11:52:36 +0100

Novice village boss -- address book management system

Address book management system According to the introduction video of the dark horse, I knocked it by hand. The following is its handout, with some modifications. See the end of the article for the complete code. 1. System requirements Address book is a tool that can record the information of relatives and friends. This tutorial mainly uses ...

Posted by daz_effect on Tue, 18 Jan 2022 11:16:07 +0100

[data structure] stack - stack chain (dynamic diagram, c + +, java)

The following is the main body of this article, and the following cases can be used for reference. Stack chain overview (illustration) The stack can be stored in sequence or chain, which are called sequence stack and chain stack respectively. Sequential stack allocates a continuous space and requires two pointers. base points to the b ...

Posted by Sindarin on Tue, 18 Jan 2022 11:01:49 +0100

C + + Experiment 4 - operator overloading

Experimental purpose Master operator overloading Implement operator overloading of Matrix class Experimental content In previous experiments, we implemented Matrix and its subclass Image. In this experiment, we add some overloaded operators to the Matrix class, including the assignment operator "=", the "+", "-&quot ...

Posted by Ayien on Tue, 18 Jan 2022 09:03:57 +0100

Learning notes of Essential C + +, Chapter2

preface According to the contents of Chapter 2, the second chapter mainly talks about the writing and calling of functions, which is basically the same as that of C language. Here we focus on recording what we didn't learn when learning C language. We'd better know an application scenario when we learn something. The book gives specific ...

Posted by itazev on Tue, 18 Jan 2022 06:03:03 +0100

C + + learning notes -- Standard Template Library STL

C + + learning notes ----Standard template library STL I Standard template library introduce The standard template library implements the commonly used data structures (vector encapsulated array, list encapsulated linked list, map and set encapsulated binary tree, etc.) and the basic algorithms for operating these data structures (inserti ...

Posted by plautzer on Tue, 18 Jan 2022 02:45:12 +0100

Copy Constructor

copy constructor 1. What is a copy constructor Objects of the same class have identical results in memory, and it is entirely possible to assign or copy them as a whole. This copy procedure** only needs to copy data members, while function members are public. ** When an object is created, it can be initialized with another object of the same ...

Posted by jrmckee on Tue, 18 Jan 2022 02:30:54 +0100

LeetCode 55.45. Jumping game I & II (greed)

Title Link: 55. Jumping game I Title details: Given a nonnegative integer array of , nums, you are initially at the , first subscript of the array. Each element in the array represents the maximum length you can jump at that position. Judge whether you can reach the last subscript. Example 1: Input: num = [2,3,1,1,4] Output: tru ...

Posted by shinyjoy on Mon, 17 Jan 2022 17:14:27 +0100

Create a programming language yourself

In the last section, we talked about flex. Today, we talk about bison flex is used to analyze morphology, such as your keywords and operation symbols. bison is used to analyze grammar, that is, the grammar method you define, that is, the meaning you need to express after arranging the keywords and symbols you define according to a certain form ...

Posted by bettydailey on Mon, 17 Jan 2022 16:22:01 +0100

Linux High Performance Server Programming Chapter 5 Linux network programming basic API

5.1 socket address API The accumulator of modern CPU can load (at least) 4 bytes at a time (32-bit machine is considered here, the same below), that is, an integer Number. Then the order in which these 4 bytes are arranged in memory will affect the value of the integer it is loaded into by the accumulator. This is byte order Question. Byte ord ...

Posted by IwnfuM on Mon, 17 Jan 2022 15:54:24 +0100