Let the computer speak , Knowledge points (2-2) summary :

* printf("  ");
* printf—— Print "" Text in or letter
* \n
* there “\n” Indicates to let the cursor “ Line feed ”
* system("pause");
* Its function is to make the computer “ suspend once ”
* getchar();
* This line of code causes the program to wait for keystrokes , The window closes after the user presses a key .
A little more colorful , Knowledge points (2-3) summary :

        How to set the background color and text color is , stay color Followed by two one digit numbers , The first number represents the background color , The second number indicates the text color . If in color after
Only one digit is added to the face , Indicates that only the text color is set , The background color still uses the default color .  It should be noted that one digit here is actually 16 Hexadecimal , It can only be 0,1,
2,3,4,5,6,7,8,9,a,b,c,d,e,f One of .

for example :  system("color f5");

It should be noted that in color There should be a space after it

Digital color correspondence table :

Let the computer add , Knowledge points (2-4) summary :

* a = b;
* There is one here “=”, This is not equal to the sign , It's called the giving number ( also known as Assignment number ), Similar to an arrow “←”, It means to put “=” The content on the right is assigned to “=” left .
* printf("%d", c);
* take “%d” Put between double quotation marks , Put the small house c Put it after double quotation marks , And separated by commas .
* At this time printf I found a in double quotation marks “ Debt collector ”, You know that you need to output a specific value at this time , Not symbols , The little house behind the double quotation marks c Ask for specific values .
* %d It's called a placeholder
Digital home —— variable , Knowledge points (2-5) summary :

* int
* int It's an English word integer( integer ) Abbreviation of .
* We use float To apply for a small house , Used to store decimals , The form is as follows :
* float a;
* be careful : stay C In language , Decimals are called floating point numbers , use float express . Used before printf Statement output integer , Using “%d”. At this time, you need to output small data number , To use “%f”.
okay , Let's summarize , there “ Small house ” In us C In the terminology of language, it is called variable .int and float Explain what type of data is stored in a small house , here
Call it “ Variable type ” perhaps “ data type ”.
* similar int a; perhaps float a; Form of , We call it “ Define variables ”, Their syntax The format is as follows : 
* 【 term 】 Type of variable Name of the variable , Name of the variable ;
* 【 code 】 int                   a             ,           b       ;
* be careful : If you give a small house many times a assignment , Small house a Will always be the most Last assigned value .
*           This is because c Languages are executed sequentially , After executing one item, it will continue to execute the next item .




data output —— I'll do whatever I say , Knowledge points (2-6) summary :


*  printf Statement will only output the part inside the double quotation marks , The part outside the double quotation marks is only right The part within the double quotation marks serves as a supplementary explanation .
* for example ,printf("%d+%d=%d", a, b, c);
* Display one-to-one correspondence

data input —— What I say is what I say , Knowledge points (2-7) summary :

* We need to read a number from the keyboard , Put it in a small house a in , The code is as follows :
* scanf("%d", &a);

* “&” Symbols we call “ Fetch address character ”, abbreviation “ Addressing character ”. Its function is to get a small house a Address of .
* output a The value in does not require an address , And input needs
* For example : If you want to go to a classroom , Then you need to know before class The address of this classroom , So you can go ; But if class is over , You need to get out of this
classroom , Because you are already in the classroom , So the address of this classroom is no longer needed .
How many kinds of small houses are there , Knowledge points (2-8) summary :


* float and double All placeholders are %f, Can also be written as %.15f, there .15 Indicates that it is accurate to the decimal point 15 position
* Here's a special explanation , stay use scanf Read in double The placeholder used for data types is “%lf”( Note that this is not a number 1 It's letters l) instead of “%f”.
* use char Small house applied for Is used to store characters . If you enter a string of characters, only the first character will be saved .
                                      char The duty cycle of is %c

Logical challenge 1: Exchange numbers in small houses , Knowledge points (2-10) summary :

* Now there are a=1,b=2, To exchange a,b Value of , Can't write directly


* A new register needs to be defined .
        because c Language statements are executed anterograde .

* There's another one , No method to define new variables :
                scanf("%d%d", &a, &b);                  // a=1,b=3

                a=b-a;                                             //a=2,b=3

                b=b-a;                                             //a=2,b=1

                a=b+a;                                           //a=3,b=1;

                printf("%d %d", a, b);

How to write comments :

  //   or  /* */


Daily Recommendation