# King Saud University College of applied studies and community services CSC 206 Programming with Basic Lecture 1.

## Presentation on theme: "King Saud University College of applied studies and community services CSC 206 Programming with Basic Lecture 1."— Presentation transcript:

King Saud University College of applied studies and community services CSC 206 Programming with Basic Lecture 1

BASIC Stands for Beginners’ All-Purpose Symbolic Instruction Code Developed to teach programming to college students Became very popular with the introduction of the microcomputer

Outline and Objective What Is A Computer Program? Software? Problem Solving Program Development Cycle Flow chart

What Is A Computer Program? Software? Program = set of instructions that a computer will follow to perform a specific task. Software = collection of programs. Two types of software: System software: used to manage computer hardware to enable us to execute & write application programs/software. Ex. Operating System, Compilers, …etc. Application Software: are meant for solving users own problems. Ex. Word processors, database management…etc.

5 Program Development Cycle: 1. Analyze: Define the problem 2. Design: Plan the solution to the problem 3. Develop the Interface: Select the objects

Program Development Cycle: 4.Code: Translate the algorithm into a programming language. 5. Debug and Test: Locate and remove any errors in the program. 6. Complete the Documentation: Organize all the materials that describe the program

The Software Development Method 1. Specify the problem requirements. 2. Analyze the problem. 3. Design the algorithm to solve the problem. 4. Implement the algorithm. 5. Test and verify the completed program. 6. Maintain and update the program. 7

خطوات حل المسائل وخطوات كتابة البرامج : صياغة حل المسألة : اولا : اولا : تعريف وتحليل عناصر المسألة وذلك يتم بالتالي : تحديد مخرجات البرنامج تحديد مدخلات البرنامج تحديد عمليات البرمجه ثانيا ثانيا : كتابة الخوارزم وذلك بكتابة الخطوات الخوارزمية للمسألة. ثالثا ثالثا : رسم مخططات الانسياب

مثال : اكتب برنامجا بحيث يقرأ رقمين صحيحة ثم يطبع مجموعهم الحل : اولا : اولا : تعريف وتحليل عناصر المسألة وذلك يتم بالتالي : تحديد مخرجات البرنامج : مجموع العددين z تحديد مدخلات البرنامج : الرقمين الصحيحة x, y تحديد عمليات البرمجه : عملية الجمع z=x+y ثانيا ثانيا : كتابة الخوارزم 1. ندخل رقمين x y 2. نحسب مجموع العددين z=x+y 3. نطبع ناتج الجمع 4. النهاية

h البداية start Input x,y ادخل x, y اطبع z Output z احسب z=x+y process النهاية end

كتابة البرنامج وتنفيذه : كتابة البرنامج بواسطة احدى لغات البرمجه ترجمة البرنامج الى لغة الاله. اختبار البرنامج واصلاح الاخطاء.

What is a flowchart? Diagram that visually represents the steps that the program performs to arrive at a solution. A popular logic tool used for showing an algorithm in graphical form. Programmer draws flowchart before coding.

13 Most common flowchart symbols are: – Flowline – Terminal – Input/Output – Processing – Decision

Purpose of Flowcharting: An aid in developing the logic of a program. Verification that all possible conditions have been considered in a program. Provides means of communication with others about the program. A guide in coding the program. Documentation for the program.

2.5The if Selection Structure true false grade >= 60 print “Passed ”

17 Example of Flowchart: Start Initialize counter and sum to 0 Are there more data? Get next grade Increment counter Add grade to sum Yes No Average=sum/counter Finish

Exercise Write a program to process a collection of daily temperatures. Your program should count and print the number of hot days (85 or higher), the number of pleasant days (60 - 84), the number of cold days (less than 60). It should also display the category of each temperature. 18

Exercise 1. Specify the problem requirements 2. Analyze the problem Input: Output: temperature A program is required to process daily temperatures and provide the total number of hot, pleasant, and cold days. total number of days in each category 3. Design the algorithm to solve the problem 1. Get the temperature. 2. Determine category of that temperature and increment counter for that particular category. 3. Display categories and total number of days that fell under the category. 19

>=85? Print Hot, Cold, and Pleasant End Add 1 to Hot Yes Add 1 to Cold Yes <=60? No Add 1 to Pleasant No Get Temp Exercise Start 20

Exercise write a program that reads the number of a hours an employee works and calculate an overtime pay for employees who work more than 40 hours and then display the paycheck. write a program that reads the name and grade of a student, and displays a note that shows wither the student passed or failed. write a program that reads the whether temperature In F° and then display it in C°. write a program that reads three numbers, then displays the sum, the average, and the largest of these numbers. 21

Download ppt "King Saud University College of applied studies and community services CSC 206 Programming with Basic Lecture 1."

Similar presentations