C + + classes and objects
Process oriented and object-oriented
Process oriented: focus on the process of problem solving, and gradually solve the problem through function call. Object oriented: focus on the objects involved in the problem, split one thing into different objects, and solve the problem by the interaction between objects.
Class introduction
Com ...
Added by McChicken on Tue, 15 Feb 2022 08:38:48 +0200
Share several practical embedded C programs
1. Hexadecimal character to integer number
Function: convert hexadecimal string to hexadecimal number. I didn't find the corresponding library function, so I wrote a function manually with reference to the online code.
The commonly used functions are ATOI and Atol, which convert decimal digit strings into int or long types, so they are not ap ...
Added by Mark W on Tue, 15 Feb 2022 07:34:59 +0200
Minimum spanning tree and bipartite graph in graph theory (acwing template)
Directory navigation:
Minimum spanning tree:
For a graph with n points, the edges must be greater than or equal to n − 1. The minimum spanning tree is to select from these edges
N-1 edges connect all n points, and the sum of edge weights of these n − 1 edges is the smallest of all schemes
One more thing:
There are n ...
Added by Crave on Tue, 15 Feb 2022 05:56:21 +0200
[data structure] (Yan Weimin version) implementation and code of relevant functions of sequence table
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define MAXSIZE 100
#define OK 1
#define ERROR 0
#define OVERFLOW -2
using namespace std;
typedef int Status;
typedef int ElemType;
typedef struct{
ElemType *elem;
int length;
}SqList;
//Linear table initialization
Statu ...
Added by parboy on Mon, 14 Feb 2022 13:59:50 +0200
C + + core programming
Object oriented programming idea
1, Memory partition model
When the C + + program is executed, the memory is divided into four areas
Code area: it stores the binary code of the function body, which is managed by the operating systemGlobal area: store global variables, static variables and constantsStack area: automatically allocated and ...
Added by dcinadr on Mon, 14 Feb 2022 06:46:58 +0200
[Floodfill model in search]
1.ACW1097: Pond count Title:'W': Water,'.': Dry, find the number of puddles. Idea: The most basic Floodfill. The code is as follows:
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
const int N = 1010;
typedef long long LL;
typedef pair<LL, LL> PII;
char c[N][N];
LL n,m;
bool st[N][N];
int dx[8] = {-1, ...
Added by erth on Sun, 13 Feb 2022 20:19:22 +0200
Shortest path algorithm template (Dijkstra, Bellman_ford, spfa, Floyd)
Summary of shortest path algorithm templates
In graph theory, the graph is directed and undirected, and only the algorithm of the directed graph is considered here. For undirected graphs, we see them as a special kind of directed graph, for all undirected edges
u
↔
...
Added by cougar23 on Sun, 13 Feb 2022 20:04:49 +0200
Encapsulation of string class -- c++
Encapsulation of string class
General code
Header file
#pragma once
#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
class MyString//The string should maintain a character array in the heap
{
public:
MyString(const char* str);//Parameterized constructor
MyString(const MyString& str);//copy cons ...
Added by rekha on Sun, 13 Feb 2022 17:12:37 +0200
Depth operator overload
Depth operator overload (2)
1. When an operator is overloaded, when is it returned as a reference and when is it returned as a value?
Return as value:
Int operator+(const Int& it)
{
this->value += it.value;
return Int(this->value + it.value);
}
Return by reference:
Int &operator+=(const Int &it)
{
...
Added by phpPete on Sun, 13 Feb 2022 16:29:46 +0200
On the mechanism of message mapping and command passing in MFC
This paper is mainly based on Hou Jie's MFC in simple terms, and mainly describes the MFC message mapping and transmission mechanism.
How to form a message mapping network
1 add the code of message mapping table in the source file
First, you must declare the message mapping table in the header file (. H)
class CScribbleDoc : public CDocumen ...
Added by EvilWalrus on Sun, 13 Feb 2022 15:07:59 +0200