C + + is one of the most commonly used programming languages in the world.
Well-written C + + programs are fast and efficient.
The language is more flexible than other languages because you can use it to create a variety of apps,
Includes fun-stimulating games, high-performance science software, device drivers, embedded programs, and Windows client applications.
Over the past more than 20 years, C + + has been used to address many of these and other issues.
You may not know that more and more C + + programmers are abandoning outdated C-style programming and using advanced C + + instead.
One goal of C + + is to make programs both type-safe and easier to write, extend, and maintain.
Modern C + + emphasizes:
1. Stack-based range, not heap or static global scope.
2. Automatic type inference, not an explicit type name. Auto ...
3. Smart pointer instead of raw pointer.
4.std::string and std::wstring types, rather than primitive char[] arrays.
5. Standard Template Library (STL) containers, such as vectors, lists, and maps, rather than raw arrays or custom containers.
6.STL algorithm, rather than manual coding algorithm.
7. Exceptions, can report and handle error conditions.
8. Use the STL std::atomic<>, rather than the non-locking inter-thread communication mechanism for inter-threaded communication.
9. Inline lambda functions, not small functions that are implemented individually.
10. Range-based for loop, written in for (for-range-declaration:expression) Form
Use a more reliable loop of arrays, STL containers, and Windows runtime collections. The For_each is cleaner and easier to use than a for loop and is not prone to unexpected errors.
For each (auto var in collection_to_loop)
{
}
C + + has risen again because functions are once again in the first place.
Languages such as Java and C # are good choices when programmers are very productive.
But when functionality and performance are critical, such languages expose their own limitations.
Modern C + + is unmatched for high efficiency and powerful functionality, especially on devices with limited hardware.
Int
4 bytes
The default selection for integer values.
Double
8 bytes
The default selection for floating-point values.
bool
1 bytes
Represents a value that can be true or false.
Char
1 bytes
Used for earlier C-style strings or std:: string objects that do not need to be converted to UNICODE ASCII characters.
wchar_t
2 bytes
Represents a "wide" character value that may be encoded in UNICODE format (UTF-16 on Windows, which may be different on other operating systems). This is the character type used for the std::wstring type string.
unsigned char
1 bytes
C + + has no built-in byte type. Use unsigned char to represent the byte value.
unsigned int
4 bytes
The default options for the bit flags.
Long Long
8 bytes
Represents a very large integer value.
Use two functions to push the program to start and stop: Main and exit.
In C + +, you can exit a program in several ways:
Call exit () destroys all static objects, empties all buffers, closes all I/O, and then terminates the program
Call Quick_exit ()
Call Abort () terminates immediately, does not clean
Call Terminate ()
Executes the return statement from Main.
The only "right and portable" main ()
int main ()
{
}
And
int main (int argc, char* argv[])
{
}
C + + defines a cryptic return 0, at the end of Main ().
Simple Introduction to modern C + +