5 Structured Programming 1 BC 320 Introduction to

--บทท 5 - - การเขยนโปรแกรมแ บบมโครงสราง Structured Programming 1 BC 320 Introduction to Computer Programming






����� ของ����� 0 ���� � 0 Print_Report 1 1 Process 1 1. 2 Process 1. 1 Process 1. 2 ���� � 1 ���� � 2 7 BC 320 Introduction to Computer Programming






ตวอยาง โปรแกรมรบขอมลจำนวนสนคาและราคาสน คา Input Process Output ? ? ? START Price = 0 READ Amt, Cost Price = Amt*Cost WRITE Price STOP BC 320 Introduction to Computer Programming 13


ตวอยาง โปรแกรมรบอณหภมสงสดและตำสดเพอคำนว ณคาเฉลย Input Process Output ? ? ? START Avg. Tmp = 0 READ Mx. Tmp, Mn. Tmp Avg. Tmp = (mx. Tmp+Mn. Tmp)/2 WRITE Avg. Tmp STOP 15 BC 320 Introduction to Computer Programming



�� 18 BC 320 Introduction to Computer Programming


Click me!! 20 BC 320 Introduction to Computer Programming





ตวอยาง โปรแกรมแสดงผลการสอบทางหนาจ อ Input Process Output ? ? ? START Read Score>=50 Y Write ‘You pass’ N STOP 25 BC 320 Introduction to Computer Programming





ตวอยาง โปรแกรมแสดงผลการสอบทางหนาจ อ START Input ? Process Output ? ? Read Score>=50 Y Grade = ‘Pass’ N Grade = ‘Fail’ Write Grade BC 320 Introduction to Computer Programming STOP 30





ตวอยาง Y Grade = ‘A’ START Read Score N Score>=80 Y N Score>=70 Y Grade = ‘B’ Grade = ‘C’ Score>=60 Y Grade = ‘D’ Write Grade BC 320 Introduction to Computer Programming STOP N Score>=50 N Grade = ‘F’ 35

���� 36 BC 320 Introduction to Computer Programming






ตวอยาง START Read Score CASE Score OF 80 -100 Grade = ‘A’ 70 -79 60 -69 Grade = ‘B’ Grade = ‘C’ 50 -59 Grade = ‘D’ ELSE Grade = ‘F’ Write Grade STOP BC 320 Introduction to Computer Programming 42


- Slides: 44