C
Outline
 • C programming
 •
 •     F
 •        F
 • Flowchart (   F   )
Programming language
 •                            F
             F            F

 •                   FF           F           (machine
     language)   F                    2
      –      F       ,                    ,      F
Programming language
 •                            -
           FF F                       F   F            F
                                                  (F
     Compiler, Interpreter)

 •                                F           F
C Programming
 •       F
     – F text editor  F source code
           F
     – source file               F compile   F
      C compiler
       • F F             F F source code
          compile F        F F
       •          F F object file (
               )
C Programming
   –          object file   link     library              (
                                               F
                      object code)         F         F   execute
       file
   – execute file F
             F (run) F                             F F compile
C Programming
   –            tools              text editor + compiler +
       linker F F F            F
                                  (      F
                        F )   Turbo C compiler
Text editor
                  create

Error   Source file (*.c)
                    C compiler
        Object file (*.obj)              Library (header file , *.h)
                              C linker

                         Execute file (*.exe)
• Bitwise Control          F           F         (bit)
           F                               F
   –                 F         F F F

• Pointer Implementation
  (pointer)
   –            F                              F F
• Case Sensitive                  F
              F
   –        var1                Var1
   – main() Main()                     F

•       F               F        ; (semicolon)   F
                    ;                F
    –           F                       F F          F
            F               F
• Structure language                   F
               F              F (Control
  structure) F

• Procedural language
           module ( F               F       F
             F          ) F             F
  function
F           C
                                         Preprocessor

Header     #include <stdio.h>

                                          Comment
           int main()
           {
Function        /* display message */     Statement

                printf(“Hello World”);
                return 0;
           }
F                  C
1.   F                (Header)
•        F            F                   F   F
              F
•                         F      F

•            F        F 2 F
             1.1 Preprocessor statement
             1.2 Declaration statement
F                       C
1.1 Preprocessor statement

•             F              F               F

•                 F F                #
•                   F                    F
  2
• #define         #include
F                  C
          1.1.1 #include

•          F          F                 F           F
    (Library)
•                 header file (*.h) F stdio.h, string.h
•     F         F     ( F )                     /       F
                           F       printf()               F
              F                        F       ( F          )
F                C
       1.1.1 #include

• printf()         ( F )                      F
     F standard input output
•             F              #include <stdio.h>
•          F F F       F         <>
F                     C
                1.1.2 #define
•       F            F          F F          F                            F
                            #define pi 3.14159
    -                    F idenfier pi         F       F        3.14159
                     #define pi 3.14159
    -              F F         string 3.14156                  F F
•                         preprocessor F F         ;       F
F               C
1.2 Declaration statement
• F                         (GLOBAL Variable)
• F
F                    C
2.      F               (Function)
•           F                            F      F         F
•                   F             F     (statement) F
•                               F   F F               F
•      F F                  F        F            F     F
     main()
         F
F                                 C
                     comment
•                                  F                                   (comment)
                      F
•                                      F                       F                /*
                              */
• F                       F                        F                    F            F
                                               F
•            F F                                       F           F
    //         F F                         F               F                F
F            F flowchart
Symbol                              Meaning

             Terminator Symbol



             Process Symbol



             Input/Output Symbol




                                              21
Symbol                          Meaning

         Display /Monitor Symbol



         Document Symbol



         Decision Symbol



         Keyboard Symbol



         External Subroutine Symbol
                              C Compiler
Symbol                         Meaning

         Comment Symbol



         Flowline Symbol



         On-page Connector Symbol



         Off-page Connector Symbol
F          F flowchart

• Examples:
   Terminator Symbol : F      F     F


                            START




                            STOP
F         F flowchart

• Examples:
   Process Symbol : F
F         F flowchart

• Examples:
  Input/Output Symbol : F   F
          F
F        F flowchart

• Examples:
  Display /Monitor Symbol : F    F          F
        F


                                Write sum
F        F flowchart

• Examples:
• Document Symbol : F     F   F
   F               F
F         F flowchart

• Examples:
  Decision Symbol : F
F        F flowchart

• Examples:
  External Subroutine Symbol : F   F   F
    C Compiler F F F
F          F flowchart

• Examples:
   External Subroutine Symbol
F        F flowchart

• Examples:
  Keyboard Symbol : F     F   F
  Comment Symbol : F
   F       F
F         F flowchart

• Examples:
   Offpage Connector Symbol : F
        F
F          F flowchart

• Examples:
  Flowline Symbol : F          F    F        F
  On-page Connector Symbol : F           F



                                   Yes


                       No
F               F flowchart

•        F 1             F               F
    flowchart
                                 F 3 F
         F   F   F           F
             3
F                                 F flowchart

•                   F         2                                             F
        F                                   F F
                                                  F   F                 F
                F       F F             F                 (10,000   )
            F                     F
F   F flowchart
1
•                                                     F
                           100,000        F               F
    F                                                         FF       F F
        1.       F               F   F 500,000 .
        2.           F F     F          50,000 .
•       Flowchart                             F                    F
                F F F FF                          F                    F
              F F -999
2
•         flowchart                               1        F      F
    F F                A, B, C, D,                F                   F
     F     F       F F          F
    – F F F        A F           F           Very Good
    – F F F        B F       F               Good
    – F F F        C F           F           So So
    – F F F        D F           F           Poor
    – F F F        F F               F       Fail !
    – F F F                              F    F       Invalid !
3
•                 flowchart                        F                    1
              F     F             F           F1             10 F       F F
         F              F F               F            F F          F Invalid
    Number !                  F                                     F         F F
     F                                F                       num                   F
             F F num                  10
4
•                FF F FF   F   3 F
                                     F
           F F                 F F
•      F
    Input name : Suchada
    Input sex (Male / Female) : Female
    Input year of birth : 2500
    -----------------------------
    Hello Miss. Suchada
    you are 52 years old

โครงสร้างภาษาซี2

  • 1.
  • 2.
    Outline • Cprogramming • • F • F • Flowchart ( F )
  • 3.
    Programming language • F F F • FF F (machine language) F 2 – F , , F
  • 4.
    Programming language • - FF F F F F (F Compiler, Interpreter) • F F
  • 5.
    C Programming • F – F text editor F source code F – source file F compile F C compiler • F F F F source code compile F F F • F F object file ( )
  • 6.
    C Programming – object file link library ( F object code) F F execute file – execute file F F (run) F F F compile
  • 7.
    C Programming – tools text editor + compiler + linker F F F F ( F F ) Turbo C compiler
  • 8.
    Text editor create Error Source file (*.c) C compiler Object file (*.obj) Library (header file , *.h) C linker Execute file (*.exe)
  • 9.
    • Bitwise Control F F (bit) F F – F F F F • Pointer Implementation (pointer) – F F F
  • 10.
    • Case Sensitive F F – var1 Var1 – main() Main() F • F F ; (semicolon) F ; F – F F F F F F
  • 11.
    • Structure language F F F (Control structure) F • Procedural language module ( F F F F ) F F function
  • 12.
    F C Preprocessor Header #include <stdio.h> Comment int main() { Function /* display message */ Statement printf(“Hello World”); return 0; }
  • 13.
    F C 1. F (Header) • F F F F F • F F • F F 2 F 1.1 Preprocessor statement 1.2 Declaration statement
  • 14.
    F C 1.1 Preprocessor statement • F F F • F F # • F F 2 • #define #include
  • 15.
    F C 1.1.1 #include • F F F F (Library) • header file (*.h) F stdio.h, string.h • F F ( F ) / F F printf() F F F ( F )
  • 16.
    F C 1.1.1 #include • printf() ( F ) F F standard input output • F #include <stdio.h> • F F F F <>
  • 17.
    F C 1.1.2 #define • F F F F F F #define pi 3.14159 - F idenfier pi F F 3.14159 #define pi 3.14159 - F F string 3.14156 F F • preprocessor F F ; F
  • 18.
    F C 1.2 Declaration statement • F (GLOBAL Variable) • F
  • 19.
    F C 2. F (Function) • F F F F • F F (statement) F • F F F F • F F F F F F main() F
  • 20.
    F C comment • F (comment) F • F F /* */ • F F F F F F • F F F F // F F F F F
  • 21.
    F F flowchart Symbol Meaning Terminator Symbol Process Symbol Input/Output Symbol 21
  • 22.
    Symbol Meaning Display /Monitor Symbol Document Symbol Decision Symbol Keyboard Symbol External Subroutine Symbol C Compiler
  • 23.
    Symbol Meaning Comment Symbol Flowline Symbol On-page Connector Symbol Off-page Connector Symbol
  • 24.
    F F flowchart • Examples: Terminator Symbol : F F F START STOP
  • 25.
    F F flowchart • Examples: Process Symbol : F
  • 26.
    F F flowchart • Examples: Input/Output Symbol : F F F
  • 27.
    F F flowchart • Examples: Display /Monitor Symbol : F F F F Write sum
  • 28.
    F F flowchart • Examples: • Document Symbol : F F F F F
  • 29.
    F F flowchart • Examples: Decision Symbol : F
  • 30.
    F F flowchart • Examples: External Subroutine Symbol : F F F C Compiler F F F
  • 31.
    F F flowchart • Examples: External Subroutine Symbol
  • 32.
    F F flowchart • Examples: Keyboard Symbol : F F F Comment Symbol : F F F
  • 33.
    F F flowchart • Examples: Offpage Connector Symbol : F F
  • 34.
    F F flowchart • Examples: Flowline Symbol : F F F F On-page Connector Symbol : F F Yes No
  • 35.
    F F flowchart • F 1 F F flowchart F 3 F F F F F 3
  • 36.
    F F flowchart • F 2 F F F F F F F F F F F (10,000 ) F F
  • 37.
    F F flowchart
  • 38.
    1 • F 100,000 F F F FF F F 1. F F F 500,000 . 2. F F F 50,000 . • Flowchart F F F F F FF F F F F -999
  • 39.
    2 • flowchart 1 F F F F A, B, C, D, F F F F F F F – F F F A F F Very Good – F F F B F F Good – F F F C F F So So – F F F D F F Poor – F F F F F F Fail ! – F F F F F Invalid !
  • 40.
    3 • flowchart F 1 F F F F1 10 F F F F F F F F F F Invalid Number ! F F F F F F num F F F num 10
  • 41.
    4 • FF F FF F 3 F F F F F F • F Input name : Suchada Input sex (Male / Female) : Female Input year of birth : 2500 ----------------------------- Hello Miss. Suchada you are 52 years old