搜尋此網誌

2025年4月2日星期三

The C++ Standard Library

A function is a block of code that performs a specific task. Functions are used to avoid repetition, improve code readability, and organize logic.

A class is a blueprint for creating objects, encapsulating data (attributes) and functions (methods) that operate on that data.

An algorithm is essentially a step-by-step procedure or set of rules for solving a problem or completing a task. Algorithms can be implemented in programming to perform operations, compute results, or automate tasks efficiently

In C++, a string is a sequence of characters. Strings are used to store and manipulate text.

In C++, containers and iterators are core components of the Standard Template Library (STL), used for efficient data storage and traversal.

cin: character input

cout: character output

The insertion operator (<<) in C++ is primarily used with streams to output data. It sends data to an output stream, such as std::cout, which allows you to print text or variables to the console.

The extraction operator (>>) in C++ is used with input streams like std:cin to extract or read data from an input stream into variables.

concatenation: a series of things or events that are linked together

In C++, cstdlib and cstdio are two standard library headers inherited from the C language.

The <cstdlib> header includes general-purpose functions that are useful for tasks like memory allocation, conversion, random number generation, and process control.

The <cstdio> header provides input/output functions for file and console operations, closely mirroring their C counterparts.

The <cmath> header in C++ provides mathematical functions for performing common operations like trigonometry, exponentiation, logarithms, and more.

log10 1000 = 3

In C++, shared_ptr and unique_ptr are part of the Standard Library's smart pointers provided in the <memory> header.

unique_ptr: exclusive ownership

shared_ptr: shared ownership

In C++, threads allow you to execute code in parallel, enabling multitasking and improving performance, especially for computationally intensive programs.

using namespace std is not recommended in large programs. In larger or complex programs, it might introduce ambiguities if multiple namespaces (e.g., std and custom namespaces) define identifiers with the same names.

Microsoft Copilot

沒有留言:

發佈留言