Based on the multithreading implementation of Linux C language, find the number of prime numbers from 30000000 to 30001000 (four threads as an example)

1, Procedural thought         Threads are characterized by independence, concurrency, and threads share memory. Think of the main function as a main thread. The work of the main thread is to allocate the number from 30000000, and the four sub threads grab the number from the main thread. This requires an intermediate varia ...

Posted by d22552000 on Thu, 07 Oct 2021 12:01:37 -0700

Beginners Practice Small Items--Implement of Large Plus and Minus Classes (C++)✨

Why do I need large plus or minus classes? For computers, the basic data type is generally up to 64-bit data representation range, this range is limited, can not represent all the data infinitely, then is there a way to represent all the large numbers, and complete the addition, subtraction, multiplication and division? The answer ...

Posted by Haggen on Thu, 07 Oct 2021 09:40:23 -0700

c + + design pattern

brief introduction Take the following code as an example 1, Decompose Shape.h class Point{ public: int x; int y; }; class Line{ public: Point start; Point end; Line(const Point& start, const Point& end){ this->start = start; this->end = end; } }; class Rect{ public: Point leftUp; in ...

Posted by badproduce on Wed, 06 Oct 2021 20:39:13 -0700

[LFS series] DIY Linux system from scratch: building LFS system - GCC-4.9.2

GCC package includes GNU compiler set, including C and C + + compilers. Install GCC First, go to the source directory and unzip the package: cd /sources tar xf gcc-4.9.2.tar.bz2 cd gcc-4.9.2 For GCC documents, it is recommended to compile GCC in a special compilation directory outside the source code directory: mkdir -v ../gcc-build cd .. ...

Posted by kerepuki09 on Wed, 06 Oct 2021 20:37:18 -0700

C + + design pattern builder pattern (the construction of complex objects is separated from their representation) the production process of different KFC roast chickens

reflection: Why can KFC McDonald's fast food stand in China, a country with 5000 years of history? Why can't Chinese shredded pork with fish flavor become a popular fast food? Because McDonald's KFC uses uniformly made fast food, which is equivalent to that the chef is a chef, and every restaurant in China has fish flavored shredded meat, ...

Posted by smilesmita on Wed, 06 Oct 2021 20:00:17 -0700

C + + final course design - hotel room management system (detailed report + source code + detailed notes) (add "25 +" C++&&C language final course design system download address)

Hotel room management system report catalogue Hotel room management system report 1, Description 2, Design idea and overall design 3, Detailed design 1. Function realization of main function 2. Realization of reservation function 3,   Realization of check-in function 4,   Realization of check-out settlement function 5. Reali ...

Posted by leeperryar on Wed, 06 Oct 2021 19:15:07 -0700

Likecloud - eat, eat, eat

1. Main idea of the topic Title Description Luogu P1508 Original title Li Da Buffalo, which is in a certain period, has been in a state of hunger recently because of its relatively developed digestive system. One day in class, just as he was dizzy with hunger, an M suddenly flashed in front of him × n(n,m ≤ 200), and I am just ...

Posted by ajlisowski on Wed, 06 Oct 2021 18:02:43 -0700

[C/C + + basics] (type conversion Series II) static_cast and traditional C Style Cast

conclusion In C + + code, try to use static for basic types (int, float, void, enum, pointer, etc.)_ Cast instead of C-style cast.For the conversion between inheritance classes, try not to use static_cast uses dynamic instead_ Cast because of lack of sufficient security. static_cast The usual forms of use are: new_type b = static_cast & ...

Posted by art15 on Wed, 06 Oct 2021 17:11:36 -0700

C + + review notes: the reference of C + + is a little unfathomable

1. Write in front c + + online compilation tool, which can quickly carry out experiments: https://www.dooccn.com/cpp/ I plan to pick up c + + again during this period of time. One of my experiences from the internship is that algorithm engineers are to solve practical problems. Therefore, they should not be limited by algorithms or engineerin ...

Posted by KyleVA on Wed, 06 Oct 2021 12:16:24 -0700

Core programming of C + + Notes

Classes and objects The three characteristics of C + + object-oriented are encapsulation, inheritance and polymorphismC + + believes that everything is an object, and there are attributes and behaviors on the object For example: People can be objects. Their attributes include name, age, height and weight... Their behaviors include walking, ru ...

Posted by laffin on Wed, 06 Oct 2021 08:47:09 -0700