String processing summary

1, String input 1. Enter a single string You can use the scanf function to split the input string with a space. The code is as follows: 1 #include <stdio.h> 2 #include <string.h> 3 4 int main() { 5 char str[100]; 6 // One input string, ending with a space 7 while(scanf("%s", str) != EOF) { 8 printf("%s ...

Posted on Mon, 06 Apr 2020 12:05:52 -0400 by cmgmyr

C language for solving linear equations

Gauss Jordan algorithm is used to solve the classical problems. It is required that any form of linear equations can be dealt with properly, and can not only be applied to the special cases where the number of equations and unknown quantities are equal. At the end of the cycle, the number of non-zero rows of the ladder matrix is obtained. At th ...

Posted on Mon, 06 Apr 2020 11:56:31 -0400 by jim.davidson

Review again - pointer, secondary pointer, linked list

First level pointer int *p; / / a pointer P defining an int type (4 bytes) &p / / indicates the address location of p p / / indicates the address location pointed to by p (that is, the value of p variable) *p / / indicates the content in the address pointed to by p   So * function: the value of the p variable is used as the address ...

Posted on Sat, 04 Apr 2020 06:13:43 -0400 by rd2010

[C + + multithreading series] [v] multitasking concurrency in different scenarios

Recently, I am working on A project, which needs to provide A set of C language interface for upper layer A, and A total of C + + calls for upper layer A. The upper layer is concurrent. In different scenarios, the lower interface is different. For example, C and D. the upper C + + interface cannot directly see the different implementation of th ...

Posted on Thu, 02 Apr 2020 10:47:47 -0400 by sethadam1

Spin lock provided in Windows and pthread

Spin lock is provided in Windows and POSIX. We can also use C++11's atomic to implement spin lock. So what is the performance relationship between the two? First, introduce the implementation code: #ifndef __spinlock_h__ #define __spinlock_h__ #include <atomic> #ifdef _WIN32 #include <Windows.h> class spinlock_mutex { public: ...

Posted on Wed, 01 Apr 2020 21:26:40 -0400 by dankstick

Chapter four of Python zero basic learning

-—-CH04 homework-—- 0. How many times will the following code print "I love fish C!" Answer: infinite times, because 'C' = 67 == truth, meets the cycle condition of while 1. How many times will the following code print "I love fish C!" 1. i = 10 2. while i: 3. print('I love fish. C!' ...

Posted on Tue, 31 Mar 2020 14:57:40 -0400 by christine75

Spiral broken line -- the seventh question of the 9th Blue Bridge Cup C language B group (provincial competition)

Original As shown in figure p1.png, the spiral polyline passes through all the whole points on the plane exactly once.  For an entire point (X, Y), we define its distance from the origin dis(X, Y) as the length of the spiral segment from the origin to (X, Y).  For example, dis(0, 1)=3, dis(-2, -1)=9Given the whole point coordinates ( ...

Posted on Tue, 31 Mar 2020 14:11:02 -0400 by ramjai

What can I do after learning the three structures of C language? (write a calculator and keep updating)

Name: Gong Zheng Place: Home Experiment time: March 25, 2020 Experimental items: Purpose and requirements of the experiment 1,...... 2,...... Experimental content Experiment exercise: 1. Simple description of the problem: simple description of the project 2 experiment code: it needs to use MARKDOWN to insert code. 3 problem analysis: (focus on ...

Posted on Tue, 24 Mar 2020 09:18:30 -0400 by shivers

Lyrics parsing under Ubuntu

We need to make clear the purpose to achieve synchronization of songs and lyrics. 1. Remove the lyrics file to memory at once.(Take Zhou Dong's "simple love" as an example) a. Open the lyrics file FILE *fp = fopen with fopen ("simple love.lrc", "r"); (r->read-only) b. Use fseek to position the file stream point ...

Posted on Thu, 19 Mar 2020 21:44:53 -0400 by fwegan

Make printf printing more colorful

Basic principle On the terminal that supports ANSI color control, the character display mode of the terminal can be changed by ANSI control code; So we can use printf or cout to output specific ANSI control code to change the following string output to the desired display mode; The ANSI control code uses ESC as the start mark ...

Posted on Thu, 19 Mar 2020 14:29:18 -0400 by jeliot