acwing game 24

acwing game 24 This week's competition has three topics: simulation, enumeration and simulation acwing 4070. XOR Link: 4070. XOR - AcWing question bank Title Description Problem solving ideas Very simple simulation, record the maximum value and the last input when entering, and don't even open the array code #include<iostream> ...

Posted by gonsman on Thu, 10 Feb 2022 16:50:50 +0100

An easy-to-use C++ command line analyzer, SmpCommandLine

An easy-to-use C++ command line analyzer, SmpCommandLine Everything starts with simplicity. This article introduces a simple command line analyzer, SmpCommandLine. SmpCommandLine is a lightweight C++ package that extracts parameters that users enter on the command line. There are already many command line analysis tools in the world, such as ...

Posted by alwaysinit on Thu, 10 Feb 2022 16:29:19 +0100

C + + 3 | static members and friends

3, Static members and friends 1. Constant (const is used in C + + as in C language) class A{ public: A():x(100){} const int x;//Constant data member void func() const;//Constant member function const A a;//Constant object } Example 9. Parameter passing characteristics of constant member functions and constructors ...

Posted by simonp on Thu, 10 Feb 2022 16:13:08 +0100

Blue Bridge Cup [real exercise] weight of complete binary tree

[problem description] Given a complete binary tree with N nodes, each node in the tree has a weight, which is A1, A2, ···· AN from top to bottom and from left to right, as shown in the following figure: Now Xiao Ming wants to add up the weights of nodes with the same depth. He wants to know which depth has the ...

Posted by fluvius on Thu, 10 Feb 2022 14:52:25 +0100

C + + learning notes (11): common containers in STL

This blog post is a note taken when learning the C + + video of dark horse programmer. It is only convenient to review the old and know the new. It is not used for other purposes. 1, string container 1.1 basic concept of string 1. Essence: String is a C + + style string, and string is essentially a class 2. The difference between string ...

Posted by Anarchatos on Thu, 10 Feb 2022 13:17:35 +0100

Explore polymorphism in C + +

Concept of polymorphism 1 Generally speaking, it is a variety of forms. Specifically, it is to complete a certain behavior. When different objects complete it, they will produce different states. 2 Definition and implementation of polymorphism 2.1 composition conditions of polymorphism Polymorphic conditions are introduced with the help ...

Posted by hadingrh on Thu, 10 Feb 2022 12:37:05 +0100

STL_ functors (function objects)

Imitation function (function object) Imitation function is the early name of C + +, and the finalization of C + + Standard Specification adopts function object Function object: an object with function characteristics. From the perspective of behavior, the use of imitation function in Chinese is more prominent From the perspective of calling, i ...

Posted by ziggs on Thu, 10 Feb 2022 11:57:30 +0100

[a little c + + knowledge a day] 015: three methods of creating c++11 threads

1. Create a thread with an initial function    note that when c + + runs an executable program (creates a process), it will automatically create a main thread. This main thread and the process live and die together. When the main thread ends, the process ends. #include "pch.h" #include <iostream> #include<thread> void pr ...

Posted by ikscovski on Thu, 10 Feb 2022 10:07:15 +0100

C + + polymorphic and virtual functions quick start tutorial

C + + polymorphic and virtual functions quick start tutorial As mentioned in the previous chapter, the pointer of the base class can also point to the derived class object. Please see the following example: #include <iostream> using namespace std; //Base class People class People{ public: People(char *name, int age); void displa ...

Posted by cdrees on Thu, 10 Feb 2022 10:05:43 +0100

C + + string input (getline is used correctly)

Correct use of getline 1. String input 1.1 common errors and causes #include<iostream> const int SIZE=50;    //Array length using namespace std; int main() {     char name[SIZE];        //name     int age;    //Age     cout << "Enter your name:" <<endl;     cin >> name;    //Enter name     cout << "Enter your age ...

Posted by devang23 on Thu, 10 Feb 2022 06:22:13 +0100