1 # include 2 using namespace std;34 class Fraction {5 private:6 int m;7 int d;8 public:9 Fraction (): m (0), d (1 ){10 cout 11}12 Fraction (int m, int d): m (m), d (d ){13 cout 14}15 void set (int m, int d ){16 this-> m = m;17 this-> d = d;18}19
C code# Include Char * ops [3] = {"sum", "sub", "mul "}; Int sum (int a, int B){Return a + B;} Int sub (int a, int B){Return a-B;} Int mul (int a, int B){Return a * B;} Void show (int opnum){Printf ("Do the operation: % s \ n", ops [opnum]);} Int (*
1. malloc and free in C language are standard library functions in C language, used to apply for dynamic memory and release memory. -Manage dynamic memory
2. For non-Internal data objects, the use of maloc/free alone cannot meet the requirements of
Void * memcpy (void * dest, constvoid * src, size_tcount) // 1. The source string must have the const Modifier{Char * pDest = (char *) (dest); // 2. Assign the original pointer to the new variableConst char * pSrc = (constchar *) (src );
// 3. The
PrefaceHashTable is also called a hash table. It is a fast data query structure. It is usually used to design a hash function H (x) for the data to be recorded ), locate the data based on this function. If it is a closed hash, it is saved directly
Common vector operations
1. Create a container
Format: vector container identifier;Several initialization methods are as follows:Vector ivec1; // empty int containerVector ivec2 (10); // container containing ten default int valuesVector ivec3 (
This question is actually not difficult. It can be answered in a very stupid way, But it wastes the time and space of the program and finds a good idea from the Internet.A number appears more than half the length of the array. That is, a number
It has been two or three years since training and learning C. At the beginning, I gave a brief introduction to pointers, but I didn't talk about memory management.After several years of work, I feel that the foundation is becoming more and more
Due to differences in operating systems and differences in the versions of the same operating system, the functions provided by the C ++ standard library are still limited and the C ++ compiler products are not fully compatible, this makes it
Two Methods of inter-process communication are introduced: clipboard and anonymous pipeline. The two processes can communicate only between processes on the local host. While the anonymous pipeline also restricts the need for a parent-child
[Disclaimer: All Rights Reserved. You are welcome to reprint it. Do not use it for commercial purposes. Contact Email: feixiaoxing @ 163.com]
We talked about the queue. Today we will discuss another data structure: Stack. A stack is almost
The macro framework system of MFC:
MFC is a C ++ class library. programmers use, inherit, and extend appropriate classes to achieve specific purposes.
CWinApp-> CTapp, CDocument-> CTDoc, CView-> CTView, CMDIFrameWnd-> CMainFrame, CMDIChildWnd->
[Disclaimer: All Rights Reserved. You are welcome to reprint it. Do not use it for commercial purposes. Contact Email: feixiaoxing @ 163.com]
String operations are the basic skills of software development. The commonly used functions include
A Class of functions in c and c ++ contain a list of all uncertain parameters, such as the classic printf (char * format ,...). This article describes how to implement functions with variable-length parameters.
contains a set of macro
# Include
# Include
# Deprecision NUM 100
Typedef struct node
{
Int x;
Int y;
} Node;
Node global [NUM] = {-999 };
Int count = 0;
Int find (int left, int right, node x)
{
Int mid = (left + right)/2;
If (left = mid)
{
If (x. x = global [right]. x)
[Disclaimer: All Rights Reserved. You are welcome to reprint it. Do not use it for commercial purposes. Contact Email: feixiaoxing @ 163.com]
As we mentioned above, the next important part of the creation of the Harman tree is the sorting of the
This document describes libusb APIs and how to develop USB applications.1 Introduction
1.1 OverviewThis document describes libusb-0.1 APIs and USB-related content.1.2 Current OS supportLinux 2.2 or laterFreeBSD/NetBSD/OpenBSDDarwin/MacOSX2 API
2.1
Article 1: smart pointer to past and presentWhen I first studied COM reference counting and smart pointers, I started with compiling the API documentation for _ com_ptr_t and CComPtr. At that time, my project manager asked me many times about the
The shift operation in C language does not have much content. However, if you do not pay attention to it, you will be negligent.
Make two questions first.
(1) unsigned char x = 3;
What is x what is 1?
(2) char x = 3;
What is x what is 1?
(3)
Speaking of the pointer to the C language, it is estimated that the C language may be a headache for the comrades who only know little about it, especially when it is connected to the array shamelessly, it is even more lewd !!!
There is a rule: (or
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.