Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the more useful functions in C++?

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report