Left value reference and right value reference

#include <iostream> using namespace std; void change(int &rnum)//A reference is an alias for a variable name { rnum =111; } //Do not use pointers where references can be used in c + + int main() { int num(10);//Lvalue, memory entity int &rnum(num);//Alias of variable rnum =1;//Alias equal to num cout << num<<end ...

Posted by daz_effect on Wed, 15 Dec 2021 04:33:22 +0100

[object oriented programming] dual timer

Experimental requirements Title: design a manually set double timer (college entrance examination countdown timer and test preparation time accumulator) to support manual setting of starting time and manual addition and subtraction of time. Basic Requirements Design a date class date. The class body needs to contain data members describing y ...

Posted by jimmyborofan on Wed, 15 Dec 2021 04:04:46 +0100

Backtracking algorithm practice - 3. Combined summation (C + + and Python description)

Source: Code Capriccio Link of force buckle in this question: https://leetcode-cn.com/problems/combination-sum/ 1. Title Description: 2. Idea: The difference between this question and the question of seeking combination is that this question has no quantitative requirements and can be limited to repetition, but it has the ...

Posted by Lexas on Wed, 15 Dec 2021 02:14:53 +0100

C++--21. Smart pointer

We know that there is no gc in C + +. The resources from new/malloc need to be released manually. At this time, some problems will occur. 1 Forget to release, 2 In case of abnormal security, these problems will lead to resource leakage and serious problems. Therefore, our smart pointer appears Why do I need a smart pointer? Memory leak ...

Posted by Huijari on Wed, 15 Dec 2021 00:58:04 +0100

UE4 learning notes [3]Components and Collision / components and collision

Chinese official documents Official documents in English Step 1: 1 Create and add ons Unreal Engine 4 (UE4). It is recommended to read the programming quick start tutorial first. In this tutorial, it is assumed that you are familiar with creating projects, adding C + + code to them, and configuring input in the Unreal Editor. If you are not f ...

Posted by Gordonator on Tue, 14 Dec 2021 20:17:16 +0100

C++STL standard library learning notes multimap

preface: In this note, I annotated most of the code. Some of my ideas and comments were marked in blue, and the key points and areas needing attention were marked in red. In this article, we mainly introduce the usage and application of multimap 1.1 usage of ultimap You need #include < Map > when using The elements in the multimap co ...

Posted by phast1 on Tue, 14 Dec 2021 13:09:52 +0100

Factory design pattern and abstract factory design pattern

Factory design mode 1. Definition Define an interface for creating objects and let subclasses decide which class to instantiate. Factory Method delays the instantiation of a class to subclasses—— Design patterns GoF 2. Code implementation Code background: implement an interface to export data, allowing customers to choose t ...

Posted by smonkcaptain on Tue, 14 Dec 2021 11:56:58 +0100

2021-12-14 [Codeforces Round #759 (Div. 2, based on Technocup 2022 Elimination Round 3)]

A. Life of a Flower Title Description Petya has an interesting flower. Petya is a busy man, so she sometimes forgets to water. From the beginning of Petya's life, you have n days. You must determine what happened to his flowers in the end. The flowers grow as follows: If the flower is not watered for two consecutive days, it will die. If th ...

Posted by niranjnn01 on Tue, 14 Dec 2021 10:30:30 +0100

c + + simple function to realize the address book management system, no linked list, no reference, no overload

Task analysis Create a function to manage the real address book; Functions include functions 1. Input of data members (members include: name, age, gender, mobile phone number, home address) 2. Query of data members; Query by name 3. Modification of data members; 4. Deletion of data members; Sequence table 5. Modification of data members; ...

Posted by zulfer on Mon, 13 Dec 2021 12:37:44 +0100

[problem solving report] guidelines of LeetCode zero foundation guide (Lecture 5)

☘ preface ☘ Today is the fourth day of the nine day training. I will record the learning contents and problem solutions and strive to be the class representative of 0.0 be careful!!!! The solution 1 of the problem solution is the solution to be mastered today, and the solution 2 is to study again when there is spare power, involving the foll ...

Posted by moreshion on Mon, 13 Dec 2021 07:15:20 +0100