Sequential structure
Sequential structure
1, definition: starting from main (), from the top down one by one to execute
2, three major types of statements, execute statements: Class 5
Control statements (9)
function call statement;
An expression statement;
Empty statement;
Compound Statement {}
How is the output implemented?
The "standard input and output function" is implemented with some library functions: printf ();
Attention:
Standard function/library functions must be used before:
#include < header file name > in included Program Files
Learning method: Header file name + function usage format
1. printf ()
Format 1:printf ("Format Control")
Function: output data in a format that is specified by the format control
Format 2:printf ("Normal/placeholder", output list value)
Function: Output values by format
Note 1: "placeholder" starts with%, is replaced
Placeholder character:
1) d signed decimal integer
2) u unsigned decimal integer
3) o unsigned octal integer
4) x or x unsigned hexadecimal integer
5) C Output one character, do not output single quotation marks
6) s outputs a string that does not output double quotes
7) F outputs a real number, implicitly outputs 6 decimal places
8) e or E output exponential form of real number
"Normal character" will be output as-is
NOTE 2: Output value, first calculated after output
2, scanf ()
Format: scanf ("normal/placeholder", address list)
Test Center 1: "Normal/placeholder", input normal character must be entered as-is
Test Center 2: "Placeholder", input 4 kinds of input
Test Center 3: "Placeholder", input 1 kinds of input
Test Center 4: "Placeholder", input 1 kinds of input
Test Center 5: Address List, input &
3. Input and output of character data
Putchar ()
GetChar ()
Learning method; header file name + function usage format
1) Putchar ()
Format: Putchar (character constant or char variable)
Function: Output one character without outputting single quotation marks
2) GetChar ()
Function: Receives a character entered from the keyboard
Note: GetChar () does not have any parameters, the return value of the function is the input character
3, C language--sequential structure