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

3,382 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,382
On SlideShare
0
From Embeds
0
Number of Embeds
2,474
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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

  1. 1. C
  2. 2. Outline • C programming • • F • F • Flowchart ( F )
  3. 3. Programming language • F F F • FF F (machine language) F 2 – F , , F
  4. 4. Programming language • - FF F F F F (F Compiler, Interpreter) • F F
  5. 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. 6. C Programming – object file link library ( F object code) F F execute file – execute file F F (run) F F F compile
  7. 7. C Programming – tools text editor + compiler + linker F F F F ( F F ) Turbo C compiler
  8. 8. Text editor create Error Source file (*.c) C compiler Object file (*.obj) Library (header file , *.h) C linker Execute file (*.exe)
  9. 9. • Bitwise Control F F (bit) F F – F F F F • Pointer Implementation (pointer) – F F F
  10. 10. • Case Sensitive F F – var1 Var1 – main() Main() F • F F ; (semicolon) F ; F – F F F F F F
  11. 11. • Structure language F F F (Control structure) F • Procedural language module ( F F F F ) F F function
  12. 12. F C Preprocessor Header #include <stdio.h> Comment int main() { Function /* display message */ Statement printf(“Hello World”); return 0; }
  13. 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. 14. F C 1.1 Preprocessor statement • F F F • F F # • F F 2 • #define #include
  15. 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. 16. F C 1.1.1 #include • printf() ( F ) F F standard input output • F #include <stdio.h> • F F F F <>
  17. 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. 18. F C 1.2 Declaration statement • F (GLOBAL Variable) • F
  19. 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. 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. 21. F F flowchart Symbol Meaning Terminator Symbol Process Symbol Input/Output Symbol 21
  22. 22. Symbol Meaning Display /Monitor Symbol Document Symbol Decision Symbol Keyboard Symbol External Subroutine Symbol C Compiler
  23. 23. Symbol Meaning Comment Symbol Flowline Symbol On-page Connector Symbol Off-page Connector Symbol
  24. 24. F F flowchart • Examples: Terminator Symbol : F F F START STOP
  25. 25. F F flowchart • Examples: Process Symbol : F
  26. 26. F F flowchart • Examples: Input/Output Symbol : F F F
  27. 27. F F flowchart • Examples: Display /Monitor Symbol : F F F F Write sum
  28. 28. F F flowchart • Examples: • Document Symbol : F F F F F
  29. 29. F F flowchart • Examples: Decision Symbol : F
  30. 30. F F flowchart • Examples: External Subroutine Symbol : F F F C Compiler F F F
  31. 31. F F flowchart • Examples: External Subroutine Symbol
  32. 32. F F flowchart • Examples: Keyboard Symbol : F F F Comment Symbol : F F F
  33. 33. F F flowchart • Examples: Offpage Connector Symbol : F F
  34. 34. F F flowchart • Examples: Flowline Symbol : F F F F On-page Connector Symbol : F F Yes No
  35. 35. F F flowchart • F 1 F F flowchart F 3 F F F F F 3
  36. 36. F F flowchart • F 2 F F F F F F F F F F F (10,000 ) F F
  37. 37. F F flowchart
  38. 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. 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. 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. 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

×