Design pattern, facade pattern, c + + implementation, delegation, c + + implementation, delegation

Delegate: Class a delegates the function to class b Class A contains a function class b pointer or object. When the function of b function class is used, the function of b is called through its pointer or object. In the view of the calling module, the problem is solved by class A. in fact, class a solves the problem through its member class b o ...

Posted by shivers on Sat, 16 Oct 2021 20:17:29 +0200

Mathematical problems in C/C + + problem brushing (common factor, common multiple, prime, etc.)

Common multiples and common factors Using the rolling division method, we can easily obtain the greatest common divisor (gcd) of two numbers; Multiply the two numbers and divide by the greatest common factor to obtain the least common multiple (LCM). int gcd(int a, int b) { return b == 0 ? a : gcd(b, a% b); } int lcm(int a, int b) { return ...

Posted by naggi on Sat, 16 Oct 2021 02:16:36 +0200

C language - Advanced pointer

1, Array parameter, pointer parameter When writing code, it is inevitable to pass [array] or [pointer] to the function. How to design the parameters of the function? 1. One dimensional array parameter transfer void test(int arr[])//ok {} void test(int arr[10])//ok {} void test(int* arr)//ok {} void test2(int* arr[20])//ok {} void test2(i ...

Posted by Dave100 on Thu, 14 Oct 2021 21:17:05 +0200

c + + handwritten numeral recognition based on template matching (Bayesian classifier)

        Hello, everyone! This article is a follow-up to the previous article. Different from the previous one, this time, the Bayesian classifier is used for number recognition. Bayesian has been taught in probability theory and mathematical statistics. Let's briefly understand it below:         First, t ...

Posted by matthijs on Thu, 14 Oct 2021 19:39:09 +0200

c + + implementation of check-in system (simple)

preface Last week, I helped my classmates do a project assignment. See the following figure for specific requirements. The implementation language is c + +. Today, I decided to write this program again. The specific and complete code is implemented at the end of the article Requirements analysis -- programming ideas Structure, class o ...

Posted by mayus on Thu, 14 Oct 2021 06:46:52 +0200

The 45th international undergraduate Programming Competition (ICPC) Asian regional competition (Nanjing) E.Evil Coordinate (classified discussion + simulation)

https://ac.nowcoder.com/acm/contest/21739/E There is a simpler way to solve this problem (enumerating all UDLR permutations). It took me 2 and a half hours to finally AC Idea: 1. First of all, we can think that given a sequence of walking methods, no matter how the sequence is arranged, its end point must be determined. Therefore, if the bo ...

Posted by vivekjain on Wed, 13 Oct 2021 16:42:16 +0200

8 C++STL set/multiset container details

2.8.1 introduction set/multiset container concept Set and multiset are a collection container, in which the elements contained in set are unique, and the elements in the collection are automatically arranged in a certain order. Set is implemented using the data structure of red black tree variant, which belongs to balanced binary tree. ...

Posted by hiberphoptik on Wed, 13 Oct 2021 02:42:50 +0200

Seven classic sorting summary analysis and code implementation

        Sorting is a problem that is very close to the reality of our life. As a programmer, the first problem encountered in the introduction of the algorithm should be these classic sorting. The learning of its ideas and the implementation of the code can let us quickly appreciate the charm brought by the algorithm. For t ...

Posted by FFFF on Tue, 12 Oct 2021 21:33:15 +0200

Learning C + + project - Fundamentals of computer network programming and learning multi threading and multi process foundation

Learn computer network programming 1, Ideas and learning methods    this article learned from: C language technology network (www.freecplus.net), and gave some understanding and reproduction. If there is infringement, it will be deleted.    now I have learned the basic knowledge of C + + and algorithms, and completed the b ...

Posted by tmann on Tue, 12 Oct 2021 05:57:58 +0200

[C + + beginner level] Introduction to C + + Chapter 1 (namespace, input & output, default parameters, function overloading, etc.)

(1) Foreword C + + is the inheritance of C language and is compatible with most C syntax. Some syntax is added on the basis of C + + in order to solve the problems that C language can't do and the modifications are not good enough What is C++ C language is a structured and modular language, which is suitable for dealing with smal ...

Posted by ywickham on Sun, 10 Oct 2021 15:17:16 +0200