0% found this document useful (0 votes)
8 views

1. Introduction to Computer Programming

The document provides an introduction to computer programming, defining key concepts such as programming languages, programmers, and the problem-solving process. It categorizes programming languages into machine, assembly, and high-level languages, and outlines steps for solving programming problems using algorithms, flowcharts, and pseudo-code. Additionally, it includes examples of algorithms and input-process-output (IPO) charts for calculating sums and areas.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

1. Introduction to Computer Programming

The document provides an introduction to computer programming, defining key concepts such as programming languages, programmers, and the problem-solving process. It categorizes programming languages into machine, assembly, and high-level languages, and outlines steps for solving programming problems using algorithms, flowcharts, and pseudo-code. Additionally, it includes examples of algorithms and input-process-output (IPO) charts for calculating sums and areas.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Introduction to Computer

Programming
CS 111 - Computer Programming
What is Computer Programming?
Computer Programming Programmers Programming Language

It means giving Programmers are the Programmers use a


instruction or directions people who write special language called,
to accomplish specific computer programs. programming languages
task. to communicate with the
computer.
There are approximately 9000+ programming languages used by software and
web developers and other professionals.
Programming Language Categories
1. Machine Language - low level languages and can directly understand by
computer but difficult to ready by humans.

2. Assembly Language - a representation of machine language. These are


instructions translates to machine language instruction called assembler.

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.

2. __________________ language is the easiest to understand, uses words


similar to human language, and is widely used by programmers today.

3. __________________ language uses simple words or mnemonics like "ADD" or


"SUB" to make it easier for humans to write instructions.
Challenge 1: Fill in the blanks (not graded)
4. __________________ refers to giving instructions to a computer to accomplish
a specific task.

5. A __________________ is the person who writes the instructions or code for a


computer to follow.

6. A __________________ is a special language that programmers use to


communicate with the computer.
How it Works: Code Translator from source code to
executable output.

cout << "Hello World!"; Binary: 10111000 00000100


00000000 00000000
Hexadecimal: B8 04 00 00 00
mov eax, B8 04 00 00 00
4 mov ebx, BB 01 00 00 00
1 mov ecx,
msg mov edx,
12 int 0x80
Challenge 2: Fill in the blanks (not graded)
1. The __________________ is where the programmer writes the code in a high-level
programming language like C++.

2. The __________________ translates the source code into an intermediate object


code, which is closer to machine code but still not executable.

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.

Steps in problem solving process:

STEP 1: Analyze the problem - Problem outline and list of requirements.

STEP 2: Plan the algorithm - Design algorithm using pseudo-code, IPO and flowcharts.

STEP 3: Check the algorithm - Trace algorithm.

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.

Flowchart - graphical representation of algorithm. There are symbols and illustration to


use.

Pseudo code - tool to plan the algorithm and use short English statements.

Programs - instruction given to a computer.

IPO Chart - use to organized the result of program analysis.


Example: Calculate the sum of two numbers
ALGORITHM

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

Process: sum = num1 + num2

Output: sum
Example: Calculate the sum of two numbers
FLOWCHART
START

num1 = 5,
num2 = 3,
sum

sum = num1 + num2

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

Process: Multiply the length by the width

Output: The area of the rectangle


Example: Calculate the area of a rectangle
FLOWCHART
START

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++

You might also like