Summary of common input problems under c/c + +

Summarize the common input formats and processing methods in the algorithm test to prevent the occurrence of obvious algorithms. However, due to the poor processing of input problems, the questions were not answered. I fell on this problem. 1, Similarities and differences of several commonly used input functions 1. scanf() You need to includ ...

Posted by sloppstack on Sat, 25 Dec 2021 08:11:47 +0100

C++list Simulation Implementation

The greatest advantage of hard work is that you can choose the life you want instead of being forced to let it be. 🎓 list introduction 1. List is a sequential container that can be inserted and deleted anywhere in the * * constant range O(1) * *, and the container can iterate back and forth, but the list container is not suitable for so ...

Posted by alexk1781 on Sat, 25 Dec 2021 05:04:24 +0100

Processing methods of inheriting members with the same name in c + + learning notes

catalogue Object model in inheritance Construction and deconstruction order in inheritance Verification Code: Inherit static member handling with the same name Verification Code: Object model in inheritance Question: which members inherit from the parent class belong to the subclass object?      1) all non static member properties in t ...

Posted by Spartan 117 on Sat, 25 Dec 2021 02:48:26 +0100

Memory allocation for structure members

Structure memory allocation For example, as shown in the following figure, there seems to be no difference except for the structure name, and there should be no difference in memory size and memory distribution, But in fact: sizeof(A) = 9 sizeof(B) = 16 This difference is caused by memory alignment. Why there is memory alignment and what ...

Posted by d99kg on Sat, 25 Dec 2021 01:18:20 +0100

Responsibility chain model

1. Basic concepts 1. Definition Enables multiple objects to process requests, thereby avoiding coupling between the sender and receiver of the request. Connect these objects into a chain and pass requests along that chain until one object processes it. 4. Examples of similar backgrounds Request process, need main procedure approval wi ...

Posted by we4freelance on Sat, 25 Dec 2021 01:12:56 +0100

Basic algorithm Course August 24, 2021

#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 20000,M=2000000; int h[N], e[M], ne[M], idx; void add(int a, int b) // Add an edge a - > b { e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ; } int match[N],st[N]; bool find(int x) { for (int i = h[x]; i != -1; i = ne[i]) ...

Posted by iamchris on Sat, 25 Dec 2021 00:31:37 +0100

[c + + compilation] makefile and CMake

Brief introduction We usually use makefile files to organize large-scale C/C + + or projects with multiple C/C + + files. Some people think that makefile is inconvenient, so they invented CMake. CMake generates a makefile file from the file containing the CMake instruction. The name of the file containing the CMake instruction is generall ...

Posted by webspinner on Fri, 24 Dec 2021 22:12:38 +0100

[Design Mode] - Bridge Bridge Bridge Mode

Bridge mode In the design of software components, if the responsibility division is not clear, the result of inheritance tends to be a rapid expansion of subclasses with duplicate code as demand changes. motivation Because of some fixed inherent implementation logic, they have two or more changing dimensions, and even more. How do you c ...

Posted by Fixxer on Fri, 24 Dec 2021 20:18:12 +0100

Introduction to C + + Zero foundation -- August 19, 2021

Introduction to C + + Basics 1. Introduction to C + + 1.1 first C + + program Writing a C + + program is divided into four steps Create projectcreate a fileWrite codeRun program 1.1. 1 create project Visual Studio is the main tool we use to write C + + programs. Let's open it first [the external chain picture transfer fails. The source s ...

Posted by arjay_comsci on Fri, 24 Dec 2021 11:38:18 +0100

C + + generic programming: non type template parameters, template specialization, separate compilation of templates

Non type template parameters There are two types of template parameters: Type parameter: This is the method we usually use, that is, add the type name of the parameter after class in the parameter list of the template.Non type parameter: a constant is used as a parameter of the template, which can be used as a constant in the template. ...

Posted by shamil on Fri, 24 Dec 2021 10:18:03 +0100