Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the more useful functions in C++?

Shulou Source: shulou.com Published: 2022-06-03 05:04:50 09月24日 Update

C++ is easier to use which functions, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.

First, cool techs function (I won't write about the commonly used ones, such as sort function)

All permutations of 1.next_permutation (axi1 ~ 1 ~ 1 ~ n) a [1 ~ 2 ~ n]

2.reverse reverses the number of a [1murn]

3.*max_element finds the maximum of a [1murn] number (* because this function is a pointer)

4.*min_element finds the minimum value of a [1murn] number (* because this function is a pointer).

5.accumulate finds the sum of a [1murn] numbers (0 is the initial value) (only supported by clock11).

6.num=unique (aplomb 1)-a mai 1; returns the number of digits after being deduplicated, and removes the weight of array a

7.rotate puts the first x number of array an after the nth number

8.lower_bound-a looks for the location of x in the subscript of array a, and returns the first pointer to a number greater than or equal to x-an is the subscript.

9.upper_bound-a looks for the location of x in the subscript of array a, and returns the pointer of the first number greater than x-an is the subscript.

10.random_shuffle (axiom 1) randomly disturbs the numbers in the subscript [1murn] in array a (antipod artifact).

11.vector a; define a dynamic array a (I won't say exactly how to use it)

12.clock () * 1.0/CLOCKS_PER_SEC returns the running time of the program (CLOCKS_PER_SEC is 1000 in Windows)

13.memdet (a _ memo _ r _ 1max _ 0x7f _ r _ r _ sizeof (a)); initialize array a (can only be 0 _ meme _ 1, positive infinity)

II. Cool techs Macro definition

1.#define N 1000 uses all the N in the program as 1000, for example: a [N] = a [1000]

2.#define liangbei (a) axi2 (hard to describe) for example: cout

Tags: Arrays compilers numbers functions subscripts pointers compilers caches technology programs support bad number location this sentence Chinese plus help output easy to use low-level Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Apple NVidia Linux Huawei