3, C language--sequential structure

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.