I. Input and output of data
Functions included in the 1.stdio.h:
GetChar (input character) gets (input string) printf (format output) Putchar (output character)
Puts (output string) scanf (format input) Flushall (flush buffer), etc.
2.flushall (); Examples of functions:
scanf ("%c", &a);
Flushall (); Action: Remove "\ n" from the buffer to prevent it from being entered
scanf ("%c", &b);
3. Format characters
Octal |
%o:55% #o: 055%d:45 |
Hexadecimal |
%x:2d%x:2d% #X: 0X2D%d:45 |
Index |
%e:1.5e+11%e:1.5e+11 |
Other format characters:%g,%g: Automatically select%e or%f based on size
Percent: output%
%.6D: Output 6 bits, less than 0 (if more than 6 bits are output as-is)
%.6S/.6C: Output 6 bits, padded with spaces
%.6F: Set the precision to 6 digits after the decimal point (rounded)
4.SCANF ("Format control string", address list);
If, in the format control string, there are other characters besides the format description, you must enter the same character at the appropriate location when entering
5.C language whitespace characters: ', ' \ t ', ' \ n '
If the format character is like "%d%f%d", then any number of whitespace characters can be inserted between each input data at the actual input.
If "%c" is used, each character is treated as valid data (including white space characters)
If a white space character appears in the format control string, the input white space character is read in without saving until the next item is encountered
C Language Learning notes-3. Sequential structure programming