Submit Search
Upload
05 ตัวแปรและชนิดของตัวแปร
•
Download as PPTX, PDF
•
0 likes
•
1,061 views
P
pirapongaru
Follow
05 ตัวแปรและชนิดของตัวแปร
Read less
Read more
Education
Report
Share
Report
Share
1 of 27
Download now
Recommended
Unit5
Unit5
นายแสงธรรม สระจันทร์
3การเก็บค่าตัวแปร
3การเก็บค่าตัวแปร
teedee111
ตัวแปรชุด
ตัวแปรชุด
Pear Pimnipa
ตัวแปรชุดนำเสนอ
ตัวแปรชุดนำเสนอ
Pz'Peem Kanyakamon
งานนำเสนอ1
งานนำเสนอ1
Janë Janejira
Operation
Operation
Komsun See
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 09
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 09
Jenchoke Tachagomain
ตัวแปรชุดและตัวแปรกลุ่มอักขระ
ตัวแปรชุดและตัวแปรกลุ่มอักขระ
BoOm mm
Recommended
Unit5
Unit5
นายแสงธรรม สระจันทร์
3การเก็บค่าตัวแปร
3การเก็บค่าตัวแปร
teedee111
ตัวแปรชุด
ตัวแปรชุด
Pear Pimnipa
ตัวแปรชุดนำเสนอ
ตัวแปรชุดนำเสนอ
Pz'Peem Kanyakamon
งานนำเสนอ1
งานนำเสนอ1
Janë Janejira
Operation
Operation
Komsun See
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 09
การพัฒนาเอกสารออนไลน์ขั้นสูง Lect 09
Jenchoke Tachagomain
ตัวแปรชุดและตัวแปรกลุ่มอักขระ
ตัวแปรชุดและตัวแปรกลุ่มอักขระ
BoOm mm
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
More Related Content
Featured
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
Featured
(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...
05 ตัวแปรและชนิดของตัวแปร
1.
ครูพีระพงษ์ ปรีดาชม ตัวแปรและชนิดของข้อมูล
2.
หัวข้อ 1.ตัวแปร (Variables) 2.ชนิดของข้อมูล (Data
Types) 3.ชนิดของตัวแปร
3.
ตัวแปร (VARIABLES)คืออะไร ?
4.
A B C ประกาศตัวแปร เช่น กาหนดค่า ตัวแปร A=5 B=10 C=
A+B 5+10=15
5.
1. ตัวแปร (VARIABLES) ตัวแปร
เป็นชื่อที่ใช้แทนการอ้างอิงข้อมูลที่เก็บ ไว้ใน Memory ตัวแปร ใช้เก็บค่าต่างๆ และสามารถเปลี่ยนค่า ได้ ในขณะประมวลผล
6.
1. ตัวแปร (VARIABLES) การประกาศตัวแปร int
X,Y,SUM; การกาหนดค่าตัวแปร X=50; Y=100; การคานวณค่าตัวแปร SUM=X+Y;
7.
1.1) การตั้งชื่อตัวแปร • กฎการตั้งชื่อตัวแปร 1.
ประกอบด้วย a - z, A - Z, 0 - 9 หรือ _ 2. อักษรตัวแรกต้องเป็น a - z, A - Z, หรือ _ เท่านั้น 3. ห้ามใช้ชื่อเฉพาะ (Reserved Words) เช่น int, if, float,... 4. ยาวสูงสุด 31 ตัวอักษร • ตัวอย่าง: • ชื่อที่ใช้ได้ เช่น i, n, _sys, K, SUM, … • แต่ชื่อที่ไม่อนุญาต เช่น int, 5j, sum 2 • ชื่อที่มีตัวพิมพ์ใหญ่ / เล็ก มีความหมายต่างกัน เช่น ชื่อตัวแปร sum, Sum, SUM ต่างกัน
8.
ในชื่อตัวแปรเหล่านี้ อันไหนบ้างที่สามารถใช้ได้ Bat CAT sum_dog SKR2562 S K
R 62skr int printf Suankularb_rangsit
9.
1.2) การประกาศตัวแปร •Data_type variable1,variable2,
… ; เช่น int X,Y; ก็จะได้ตัวแปร X กับ Y ประเภทเลข จานวนเต็ม (Integer)
10.
2. ชนิดของข้อมูล (DATA
TYPE) ในภาษา C มีหลายชนิด ควรเลือกใช้ให้ เหมาะสมกับโปรแกรมที่จะเขียน เช่น ถ้าต้องการคานวณตัวเลข ควรใช้ int(เลขจานวณเต็ม) หรือ float(เลขมีทศนิยม) ถ้าต้องการแสดงอักขระหรือข้อความ ควรจะใช้ char(อักขระ) เป็นต้น
11.
3. ชนิดของตัวแปร ข้อมูลชนิด Interger คือข้อมูลประเภทตัวเลขจานวนเต็ม เช่น
-1 , 0 , 3 , 123 เป็นต้น วิธีการประกาศตัวแปร int a,b,c;
12.
3. ชนิดของตัวแปร ข้อมูลชนิด long
integer คือข้อมูลประเภทตัวเลขจานวนเต็ม เหมือนกันแต่สามารถเก็บค่าตัวเลขได้ มากกว่า integer วิธีการประกาศตัวแปร long d,e,f;
13.
3. ชนิดของตัวแปร ข้อมูลชนิด Float คือข้อมูลประเภทจานวนจริงสามารถ เก็บค่าตัวเลขทศนิยมได้ เช่น
-1.568 , 0.235 , 6.8 เป็นต้น วิธีการประกาศตัวแปร float g,h,k;
14.
3. ชนิดของตัวแปร ข้อมูลชนิด double คือข้อมูลประเภทจานวนจริงสามารถ เก็บค่าตัวเลขทศนิยมได้เหมือน
float แต่ สามารถเก็บค่าตัวเลขได้มากกว่า วิธีการประกาศตัวแปร double z,x,c;
15.
3. ชนิดของตัวแปร ข้อมูลชนิด character คือข้อมูลประเภทอักขระ
เช่น ‘A’ , ‘b’ , ‘1’ , ’?’ เป็นต้น วิธีการประกาศตัวแปร char p,o,I;
16.
การเก็บค่าต่างๆ ของตัวแปรแต่ละชนิด
17.
ตัวอย่างรูปแบบการแสดงค่าในตัวแปร รูปแบบข ้อความปกติ รูปแบบ printf(“control string”); ตัวอย่าง printf(“Hello
SKR”);
18.
ตัวอย่างรูปแบบการแสดงค่าในตัวแปร รูปแบบแสดงค่าตัวแปร (ดึงค่าที่ตัวแปรเก็บไว ้มาแสดง) รูปแบบ printf(“control string”,variable,…..); ตัวอย่าง
เช่น ตัวแปร A เก็บค่า 50 ไว ้ printf(“%d”,a);
19.
ตัวอย่างรูปแบบการแสดงค่าในตัวแปร
20.
ตัวอย่างรูปแบบการแสดงค่าในตัวแปร
21.
ตัวอย่างรูปแบบการแสดงค่าในตัวแปร
22.
ตัวอย่างรูปแบบการแสดงค่าในตัวแปร
23.
ตัวอย่างรูปแบบการแสดงค่าในตัวแปร
24.
ตัวอย่างการใช้ตัวแปรมาประมวลผล
25.
ลาดับการคานวณ 1) ลาดับที่ 1
คานวณใน ( ) ถ้ามี ( ) ซ้อนกันหลาย วงเล็บ คานวณจากชั้นในสุดออกมา 2) ลาดับที่ 2 คานวณ เลขยกกาลัง และ กรณฑ์ จาก ซ้ายไปขวา 3) ลาดับที่ 3 คานวณ คูณและหาร จากซ้ายไปขวา 4) ลาดับที่ 4 คานวณ บวกและลบ จากซ้ายไปขวา
26.
จงแสดงลาดับในการดาเนินการของนิพจน์ 10 5 11 4
44 54 50 0 10
27.
โจทย์ปัญหา 1) X =
50*5; 2) Y = X+5*4/2+3*(5-2) 3) Z = (Y-X)*100; 4) แสดงชื่อของนักเรียน (ใช้ string)
Download now