The document discusses computer programming basics. It explains that computer programs are detailed instructions that tell the computer what actions to perform and in what order. Developing an algorithm is a type of problem solving that involves understanding the problem, designing a step-by-step solution, and potentially implementing and testing it. The order of the steps is important, and algorithms can be written out as pseudocode or displayed in a flowchart to explain the logic and flow of the program.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
112 views15 pages
Cpe 2
The document discusses computer programming basics. It explains that computer programs are detailed instructions that tell the computer what actions to perform and in what order. Developing an algorithm is a type of problem solving that involves understanding the problem, designing a step-by-step solution, and potentially implementing and testing it. The order of the steps is important, and algorithms can be written out as pseudocode or displayed in a flowchart to explain the logic and flow of the program.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15
Computer Programming
Basics Computer Programming Basics
Computer programs are a detailed set of
instructions given to the computer They tell the computer: 1. What actions you want the computer to perform 2. The order those actions should happen in An effective program therefore needs: 1. A thorough understanding of the problem 2. A well thought-out, step-by-step solution to the problem Computer Programming Basics ACTIVITY Working in groups of 2 Create a set of instructions that will tell us:
– How to eat a banana
Make your instructions as
detailed as possible, so that even someone who has never eaten a banana before can understand them HOW TO EAT A BANANA: A DETAILED LIST OF INSTRUCTIONS 1. Using your hand, get a yellow crescent-shaped fruit called a “banana” 2. Peel the outer skin off the banana (by breaking off the outer stem and peeling back the yellow peel) 3. Eat the banana 1. Put a small section of banana in your mouth 2. Bite down on the banana 3. Chew the banana by opening and closing your mouth 4. Once the banana has been chewed, swallow the banana 5. Repeat until banana is finished 4. Throw out the used banana peel Computer Programming Basics
A procedure that outlines
What actions you want the computer to perform and The order in which they happen is called an ALGORITHM An ALGORITHM is basically an outline for how your computer program will work Computer Programming Basics
Developing an Algorithm is really just a type
of Problem Solving – We have to: READ and understand the problem THINK about different solutions to the problem DESIGN an approach that will solve the problem IF NEEDED IMPLEMENT that design TEST to see if it works Computer Programming Basics THINKING about the solution often means breaking down complex tasks into smaller, easier to understand tasks These tasks must be well-defined so that we understand what the action is acting on – e.g. telling a person to grab a banana will only work if the person knows what a banana is The tasks have to be easy to understand – e.g. telling a person to PEEL a banana will only work if they understand what peeling means Computer Programming Basics
• The ORDER in which actions are performed is
also very important • Consider the following 2 algorithms that tell Mr. Solomon how to get ready in the morning
We’ll call them the “Rise-and-Shine Algorithms”
Computer Programming Basics RISE AND SHINE 1 RISE AND SHINE 2 • Get out of bed • Get out of bed • Take off pyjamas • Take off pyjamas • Take a shower • Get dressed • Get dressed • Take a shower • Eat breakfast • Eat breakfast • Drive to school • Drive to school RESULT RESULT Mr. Solomon arrives in a Mr. Solomon arrives in great mood ready to not too great a mood teach since he’s soaking wet Computer Programming Basics When the algorithm is written out as a well-thought series of steps, it is sometimes called PSEUDOCODE – It is written in easy to understand language, but is written very similar to the way that you would code it into your 3rd Generation Language HOW TO EAT A BANANA: A DETAILED LIST OF INSTRUCTIONS 1. Using your hand, get a yellow crescent-shaped fruit called a “banana” 2. Peel the outer skin off the banana (by breaking off the outer stem and peeling back the yellow peel) 3. Eat the banana 1. Put a small section of banana in your mouth 2. Bite down on the banana 3. Chew the banana by opening and closing your mouth 4. Once the banana has been chewed, swallow the banana 5. Repeat until banana is finished 4. Throw out the used banana peel Computer Programming Basics • The algorithm can also be written as a FLOW CHART • The FLOW CHART is a graphic organiser (a picture that helps organize your thoughts) • It uses a collection of basic symbols that are used to organize your algorithm • These symbols are connected by arrows that show how the algorithm “flows” Computer Programming Basics FLOW CHART SYMBOLS
TERMINAL – the beginning or ending of a
program INPUT/OUTPUT – where the user of the program is asked for information (INPUT) or where the program displays a result (OUTPUT) PROCESSING – shows any mathematical operation
CALL – shows any other pieces of the
program that are called upon
DECISION – represents any action where the
computer is making a decision Computer Programming Basics e.g. a Basic Flow Chart START