Soumettre la recherche
Mettre en ligne
การเขียนโปรแกรมเบื้องต้น9 12-58
•
Télécharger en tant que PPTX, PDF
•
0 j'aime
•
600 vues
Bipor Srila
Suivre
ความรู้ทั่วไปเกี่ยวกับภาษาซี
Lire moins
Lire la suite
Formation
Affichage du diaporama
Signaler
Partager
Affichage du diaporama
Signaler
Partager
1 sur 11
Télécharger maintenant
Recommandé
ความรู้เบื้องต้นเกี่ยวกับการสร้างเว็บเพจ
ความรู้เบื้องต้นเกี่ยวกับการสร้างเว็บเพจ
Krunicky Rattanapachai
ใบงานที่ 3
ใบงานที่ 3
Bipor Srila
โครงสร้างโปรแกรมภาษาซี
โครงสร้างโปรแกรมภาษาซี
Bipor Srila
โครงสร้างโปรแกรมภาษาซี
โครงสร้างโปรแกรมภาษาซี
Bipor Srila
ใบงานที่ 1
ใบงานที่ 1
Bipor Srila
ใบความรู้ที่1
ใบความรู้ที่1
Bipor Srila
การนำเสนอผลงาน
การนำเสนอผลงาน
Bipor Srila
การนำเสนอผลงาน
การนำเสนอผลงาน
Bipor Srila
Recommandé
ความรู้เบื้องต้นเกี่ยวกับการสร้างเว็บเพจ
ความรู้เบื้องต้นเกี่ยวกับการสร้างเว็บเพจ
Krunicky Rattanapachai
ใบงานที่ 3
ใบงานที่ 3
Bipor Srila
โครงสร้างโปรแกรมภาษาซี
โครงสร้างโปรแกรมภาษาซี
Bipor Srila
โครงสร้างโปรแกรมภาษาซี
โครงสร้างโปรแกรมภาษาซี
Bipor Srila
ใบงานที่ 1
ใบงานที่ 1
Bipor Srila
ใบความรู้ที่1
ใบความรู้ที่1
Bipor Srila
การนำเสนอผลงาน
การนำเสนอผลงาน
Bipor Srila
การนำเสนอผลงาน
การนำเสนอผลงาน
Bipor Srila
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Contenu connexe
En vedette
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
En vedette
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
การเขียนโปรแกรมเบื้องต้น9 12-58
1.
การเขียนโปรแกรมเบื้องต้น ภาษาซี
2.
1.2 ซอฟต์แวร์คืออะไร ? •
ซอฟต์แวร์(Software) หรือโปรแกรมคอมพิวเตอร์ (Computer Program) คือโปรแกรมที่ถูกเขียน ขึ้นมาจากภาษาคอมพิวเตอร์และถูกแปลงให้เป็นภาษาเครื่อง เพื่อให้คอมพิวเตอร์ทางานอย่างใดอย่างหนึ่งตามที่เราต้องการ • แบ่งออกเป็น 2 ประเภทใหญ่ๆ คือ –System software (ซอฟต์แวร์ระบบ) –Application software (ซอฟต์แวร์ประยุกต์)
3.
System Software • เป็นโปรแกรมที่ทางานเกี่ยวกับระบบคอมพิวเตอร์
มีหน้าที่ ในการควบคุมอุปกรณ์ฮาร์ดแวร์ทุกชนิด และจัดตารางการ ทางานทั้งฮาร์ดแวร์และซอฟต์แวร์ที่ทางานกับฮาร์ดแวร์ทุก ตัวซึ่งก็คือระบบปฏิบัติการ(Operating System:OS) นั่นเอง ได้แก่ DOS, Windows, Linux, Mac OS, OS/2
4.
Application Software เป็นโปรแกรมที่ถูกสร้างขึ้นเพื่อทางานด้านต่างๆ ซึ่งก็ถูกเขียนขึ้นจาก โปรแกรมภาษาต่างๆ เช่น
PowerDVD, Windows Media Player, Winamp, Word, Calculator, SPSS สามารถแบ่งออกได้หลายประเภทดังนี้ – โปรแกรมพิมพ์งาน – โปรแกรมเกม – โปรแกรมยูทิลิตี้ – โปรแกรมมัลติมีเดีย – โปรแกรมสาหรับระบบ – โปรแกรมภาษาสาหรับพัฒนาซอฟต์แวร์
5.
ภาษาคอมพิวเตอร์ • แบ่งออกเป็น 2
ประเภทใหญ่ๆ คือ –ภาษาระดับต่า ได้แก่ ภาษาเครื่อง และภาษา Assembly –ภาษาระดับสูง ได้แก่ Basic, Pascal, Ada, C, Cobol, Fortran และอื่นๆ • ความแตกต่างระหว่างภาษาระดับสูงและระดับต่าคือ ภาษาระดับต่า ควบคุมอุปกรณ์ฮาร์ดแวร์คอมพิวเตอร์ได้ดีกว่า แต่เขียนยาก และยาว มาก ส่วนภาษาระดับสูงเขียนง่ายเข้าใจง่ายกว่าเพราะใกล้เคียงภาษา มนุษย์ แต่มีข้อจากัดในการควบคุมฮาร์ดแวร์
6.
ภาษา BCPL ภาษา B ภาษา C 1. ประวัติความเป็นมา บนเครื่อง PDP-7 (UNIX) พ.ศ. 2513 พ.ศ.
2515 โดย เดนนิช ริทชี่ Basic Combined Programming Language
7.
ขั้นตอนการทาโปรแกรมด้วยภาษาซี ขั้นตอนที่ 1 เขียนโปรแกรม
(source code) ใช้ editor เขียนโปรแกรมภาษาซีและทาการบันทึกไฟล์ให้มี นามสกุลเป็น .c เช่น work.c เป็นต้น editor คือ โปรแกรมที่ใช้สาหรับการเขียนโปรแกรม โดย ตัวอย่างของ editor ที่นิยมนามาใช้ในการเขียนโปรแกรม ได้แก่ Notepad,Edit ของ Dos ,TextPad และ EditPlus เป็นต้น ผู้เขียนโปรแกรมสามารถเลือกใช้ โปรแกรมใดในการเรียนโปรแกรมก็ได้ แล้วแต่ความถนัดของแต่ละบุคคล
8.
• ขั้นตอนที่ 2
คอมไพล์โปรแกรม (compile) • นำ source code จำกขั้นตอนที่ 1 มำทำกำรคอมไพล์ เพื่อแปลจำกภำษำซีที่มนุษย์เข้ำใจไปเป็น ภำษำเครื่องที่คอมพิวเตอร์เข้ำใจได้ ในขั้นตอนนี้คอมไพเลอร์จะทำกำรตรวจสอบ source code ว่ำเกิด ข้อผิดพลำดหรือไม่ • · หำกเกิดข้อผิดพลำด จะแจ้งให้ผู้เขียนโปรแกรมทรำบ ผู้เขียนโปรแกรมจะต้องกลับไปแก้ไขโปรแกรม และ ทำกำรคอมไพล์โปรแกรมใหม่อีกครั้ง • · หำกไม่พบข้อผิดพลำด คอมไพเลอร์จะแปลไฟล์ source code จำกภำษำซีไปเป็นภำษำเครื่อง(ไฟล์ นำมสกุล .obj) เช่นถ้ำไฟล์ source code ชื่อ work.c ก็จะถูกแปลไปเป็นไฟล์ work.obj ซึ่งเก็บ ภำษำเครื่องไว้เป็นต้น • compile เป็นตัวแปลภำษำรูปแบบหนึ่ง มีหน้ำที่หลักคือกำรแปลภำษำโปรแกรมที่มนุษย์เขียนขึ้นไปเป็น ภำษำเครื่อง โดยคอมไพเลอร์ของภำษำซี คือ C Compiler ซึ่งหลักกำรที่คอมไพเลอร์ใช้ เรียกว่ำ คอมไพล์ (compile) โดยจะทำกำรอ่ำนโปรแกรมภำษำซีทั้งหมดตั้งแต่ต้นจนจบ แล้วทำกำรแปลผลทีเดียว • นอกจำกคอมไพเลอร์แล้ว ยังมีตัวแปลภำษำอีกรูปแบบหนึ่งที่เรียกว่ำ อินเตอร์พรีเตอร์ กำรอ่ำนและ แปลโปรแกรมทีละบรรทัด เมื่อแปลผลบรรทัดหนึ่งเสร็จก็จะทำงำนตำมคำสั่งในบรรทัดนั้น แล้วจึงทำกำรแปลผล ตำมคำสั่งในบรรทัดถัดไป หลักกำรที่อินเตอร์พรีเตอร์ใช้เรียกว่ำ อินเตอร์เพรต (interpret)
9.
ข้อดีและข้อเสียของตัวแปลภาษาทั้งสองแบบมีดังนี้ ข้อดี ข้อเสีย คอมไพเลอร์ ·
ทางานได้เร็ว เนื่องจากทาการแปลผลทีเดียว แล้วจึงทางานตามคาสั่งของโปรแกรมในภายหลัง · เมื่อทาการแปลผลแล้ว ในครั้งต่อไปไม่ จาเป็นต้องทาการแปลผลใหม่อีก เนื่องจาก ภาษาเครื่องที่แปลได้จะถูกเก็บไว้ที่หน่วยความจา สามารถเรียกใช้งานได้ทันที · เมื่อเกิดข้อผิดพลาดขึ้นกับ โปรแกรมจะตรวจสอบหาข้อผิดพลาดได้ ยาก เพราะทาการแปลผลทีเดียวทั้ง โปรแกรม อินเตอร์พรีเตอร์ · หาข้อผิดพลาดของโปรแกรมได้ง่าย เนื่องจากทาการแปลผลทีละบรรทัด · เนื่องจากทางานทีละบรรทัดดังนั้นจึงสั่งให้ โปรแกรมทางานตามคาสั่งเฉพาะจุดที่ต้องการได้ · ไม่เสียเวลารอการแปลโปรแกรมเป็น เวลานาน · ช้า เนื่องจากที่ทางานทีละบรรทัด
10.
ขั้นตอนที่ 3 เชื่อมโยงโปรแกรม
(link) การเขียนโปรแกรมภาษาซีนั้นผู้เขียนโปรแกรมไม่จาเป็นต้องเขียน คาสั่งต่าง ๆ ขึ้นใช้งานเอง เนื่องจากภาษาซีมีฟังก์ชั้นมาตรฐานให้ผู้เขียน โปรแกรมสามารถเรียกใช้งานได้เช่น การเขียนโปรแกรมแสดง ข้อความ “Lumpangkanyanee” ออกทางหน้าจอ ผู้เขียนโปรแกรม สามารถเรียกใช้ฟังก์ชั่น printf() ซึ่งเป็นฟังก์ชั่น มาตรฐานของ ภาษาซีมาใช้งานได้ โดยส่วนการประกาศ (declaration) ของฟังก์ชั่น มาตรฐานต่าง ๆ จะถูกจัดเก็บอยู่ในเฮดเดอร์ไฟล์แต่ละตัว แตกต่างกันไปตาม ลักษณะการใช้งาน ด้วยเหตุนี้ภาษาเครื่องที่ได้จากขั้นตอนที่ 2 จึงยังไม่สามารถนาไปใช้ งานได้แต่ต้องนามาเชื่อมโยงเข้ากับ library ก่อน ซึ่งผลจากการเชื่อมโยงจะ ทาให้ได้ executable program (ไฟล์ นามสกุล.exe เช่น work.exe) ที่สามารถนาไปใช้งานได้
11.
ขั้นตอนที่ 4 ประมวลผล
(run) เมื่อนา executable program จากขั้นตอนที่ 3 มาประมวลผลก็ จะได้ผลลัพธ์ (output) ของโปรแกรมออกมา (ถ้ามี) รูปที่ 1 ขั้นตอนการทาโปรแกรมด้วยภาษาซี
Télécharger maintenant