1. Introduction to Computer Programming
1. Introduction to Computer Programming
Programming
CS 111 - Computer Programming
What is Computer Programming?
Computer Programming Programmers Programming Language
3. High Level Language - these are mostly used by programmers today. These
are easy to read and portable. High level languages can be classified into
functional, procedure oriented, object-oriented programming (OOP) and
Logic programming languages.
Challenge 1: Fill in the blanks (not graded)
1. __________________ language is written in 0s and 1s and can be directly
understood by the computer.
3. After the compiler, the __________________ converts the object code into machine
code, which is a series of 0s and 1s the computer can directly understand.
4. Once the code is in __________________, the computer can execute it and perform
the task the programmer intended.
Problem Solving Process:
Programming is the process of solving problem using algorithms and that requires computer solution.
You will learn how to create a computer solution to a specific problem by applying pseudo-code,
input-process-output (IPO), flowcharts and algorithms.
STEP 2: Plan the algorithm - Design algorithm using pseudo-code, IPO and flowcharts.
STEP 4: Code the algorithm into a program - Implement algorithms into code.
STEP 5: Maintenance - Evaluate and modify the program if necessary. IPO chart is also applicable.
Definition of Terms
Algorithm - step by step solution to solve a problem or to accomplish specific task.
Pseudo code - tool to plan the algorithm and use short English statements.
1. Start
2. Input two numbers
3. Add the numbers
4. Display the sum
5. End
Example: Calculate the sum of two numbers
INPUT-PROCESS-OUTPUT
Input: num1, num2
Output: sum
Example: Calculate the sum of two numbers
FLOWCHART
START
num1 = 5,
num2 = 3,
sum
Print sum
END
Example: Calculate the area of a rectangle
ALGORITHM
1. Start
2. Input the length of the rectangle
3. Input the width of the rectangle
4. Compute the area using the formula: Area = Length x Width
5. Display the Area
6. End
Example: Calculate the area of a rectangle
INPUT-PROCESS-OUTPUT
Input: Length of the rectangle, width of the rectangle
Length = 10
Width = 10
Area = 10 x 10
Print Area
END
Try this!
Use algorithm, IPO, and flowchart to calculate
the average of three numbers.
Try this!
Use algorithm, IPO, and flowchart to find the
area of a circle.
Submit your work in Google Classroom under the Classwork Practice Exercise 1.
Practice Exercise 1: (not graded)
Design an algorithm, IPO chart, and
flowchart to determine whether a number is
positive, negative, or zero.
Data Types, Variables and
Operators
Data Types
Data Types
Syntax: dataType varaibleName = value;
Example below:
Data Types
Syntax: const dataType varaibleName = value;
Example below:
Operators in C++