SlideShare a Scribd company logo
1 of 16
Download to read offline
หลักการเขียนโปรแกรม
จัดทาโดย
นางสาวพัชรี แซ่โง้ว
รหัสนิสิต 60170099
เสนอ
อาจารย์กฤษณะ อิ่มสวาสดิ์
ภาคการศึกษาที่1/2560
คณะภูมิสารสนเทศศาสตร์ มหาวิทยาลัยบูรพา
ให้แปลง ค.ศ. เป็น พ.ศ.
คาสั่ง printf พร้อมข้อความให้พิมพ์ค.ศ.
พิมพ์scanf เพื่อเป็นการเก็บข้อมูลของ ค.ศ.ที่กรอก
- ในวงเล็บเป็น %D เพราะเป๋ นค่าตัวแปร int แล้วกาหนดค่าตัวแปรด้วย แต่คั่นด้วย , &CE
เพื่อบอกว่าเป็นค่าของตัวไหน
พิมพ์โค้ด SUM
- เพราะเป็นค่าของผลลัพธ์ แล้วตามด้วย = CE + 543 เพื่อเป็นขั้นตอนในการบวก ค.ศ.ที่
กรอกกับผลต่างที่จะทาให้เป็น พ.ศ.
Printf เป็นการโชว์คาตอบของ พ.ศ. ที่แปลงแล้วบนหน้าจอ
- แล้วกาหนดด้วย ‚Result of CE:%d convert to BE%d‛ เพื่อเป็นการกาหนดค่าคาตอบว่า
ผลของ CE ผลลัพธ์จะออกมาเป็น BE
- และทาการเขียนอ้างอิงข้างหลังว่า %d เป็นของค่าตัวแปรไหนบ้าง
พิมพ์โค้ด
- Getch(); เพื่อเป็นการค้างค่าผลลัพธ์ไว้
- Return 0; เพื่อเป็นการคืนค่าที่ค้างไว้ข้างต้น
กด F9 เพื่อทาการแสดงผล
- หลังจากหน้าจอแสดงผลขึ้น จะมีเคอร์เซอร์กระพริบเพื่อให้กรอก ค.ศ.ของตัวเอง
หลังจากพิมพ์ค.ศ.เสร็จแล้ว กด enter แล้วค่าผลลัพธ์จะออกมาที่อีกบรรทัดนึง เป็นค่า พ.ศ. ที่
ผ่านการ + 543 ที่กาหนดไว้แล้ว
จอแสดงผล
SWITCH
พิมพ์โค้ดตามคาสั่ง
ใช้คาสั่ง char
ใช้ตัวแปรเดียวในการพิมพ์โค้ด
พิมพ์โค้ดรายการอาหาร แล้วกาหนดตัวแปรของชื่อเมนูไว้ที่ด้านหลังของเมนู
n เอขึ้นบรรทัดใหม่
เริ่มคาสั่ง switch ตามด้วยตัวแปร
กาหนดค่าของตัวแปรชื่อเมนูอาหารด้วยคาสั่ง case ตามด้วย printf
ทุกครั้งที่เปิดคาสั่ง case ต้องปิดด้วย break ทุกครั้ง (มีกี่เคสเบรกเท่านั้น) เพื่อที่โปรแกรมจะได้
ไม่รันผลเป็นค่าตัวแปรแรกอย่างเดียว
จบด้วยคาสั่ง default ในกรณีที่คีย์ข้อมูลจากหน้าผลรันผิดพลาด
แล้วจบด้วย getch();
Return 0;
แสดงหน้าจอผลรัน
แสดงค่าผลรันหลังกรอกตัวแปรเมนู
Digital Image processing
คาสั่งอ่านไฟล์รูปภาพคือ imread
โครงสร้างคือ ตัวแปร = imread (‘ชื่อไฟล์รูปภาพ’)
กด enter แล้วจะขึ้นเป็นตัวเลข
ตัวเลขจะเป็นพิกเซลของภาพ แล้วแต่ค่าสีของรูป
คาสั่ง figure คือคาสั่งเรียกดูรูปภาพ
Figure อย่างเดียวคือเฟรมรูป
คาสั่ง imshow คือคาสั่งเรียกรูปออกมาเพื่อแสดงผลบนหน้าจอ โดยการเขียนแสดงผลภาพจะ
เขียน figure มาก่อนแล้วตามด้วย imshow
โครงสร้าง figure,imshow(ตัวแปรที่เก็บค่าภาพ)
คำสั่งดูพิกเซลภำพ
กด inspec pixel
เป็นหน้าต่างขยายภาพเพื่อดูพิกเซล
ยิ่งซูมมาก ก็จะเห็นเป็นเม็ดพิกเซล
จานวนพิกเซลดูได้ตอนเซฟรูปมาว่าขนาดใหญ่เกินไปหรือป่าว
เพราะว่าถ้ายิ่งใหญ่ก็ต้องยิ่งใช้เวลาในการดาวน์โหลดมากขึ้น
ใน 1 เม็ดพิกเซล จะมีพิกัดจุดของหน้าจอ ซึ่งเริ่มจากมุมบนซ้ายมือของหน้าจอ
ยิ่งซุมใกล้จะเห็นเป็นค่าสีแสดงอยู่ในเม็ดพิกเซล
ค่าสีจะสูงต่าอยู่ที่ความเข้มของสี
ค่าสูงสุง 255 ต่าสุด 0

More Related Content

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO 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)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 2024How 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 InsightsSocial 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 2024Trends 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 summary5 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 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 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 IntentGoogle'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 How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe 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...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

ฝน