0% found this document useful (0 votes)
7 views26 pages

Introduction to Computer Programming Basics

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)
7 views26 pages

Introduction to Computer Programming Basics

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

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

Common questions

Powered by AI

Algorithms, which are step-by-step solutions to problems, are crucial in programming for breaking down complex tasks into manageable steps. Tools used in designing and implementing algorithms include pseudo-code, which uses short English statements; flowcharts, which provide graphical representations; and IPO charts, which organize program analysis results. These tools allow programmers to systematically approach problem-solving from analysis and planning to coding and maintenance .

The steps in developing a computer program are: 1) Analyze the problem, which includes outlining the problem requirements; 2) Plan the algorithm using pseudo-code, IPO, and flowcharts to design a step-by-step solution; 3) Check the algorithm to ensure logical correctness; 4) Code the algorithm into a program by implementing it in a programming language; 5) Maintain the program by evaluating its performance and making necessary modifications. Each step ensures systematic development, from defining what needs to be done to maintaining a functional product .

Tracing an algorithm involves manually following its steps to verify that they produce the correct output for given inputs. This process helps identify logical errors, such as incorrect condition handling or incorrect sequence of steps before coding begins. Ensuring correctness at this stage reduces errors in the code, saving time and resources during the programming phase .

Evaluating and modifying a program during maintenance is crucial for ensuring that it continues to meet user needs and operates efficiently. This phase involves fixing any discovered bugs, improving performance, and possibly extending features. It is essential for keeping software relevant and effective in a changing technological environment, highlighting the dynamic nature of software life cycles .

Programming languages are categorized into machine language, assembly language, and high-level language. Machine languages are low-level and consist of binary code that is directly understood by computers but are difficult for humans to read. Assembly languages use mnemonics to simplify coding for humans and must be translated into machine code by an assembler. High-level languages are user-friendly, readable, and portable, often categorized further into functional, procedural, object-oriented, and logic programming languages .

The process of translating source code into executable output involves several steps. First, the programmer writes code in a high-level language. Next, a compiler translates the source code into intermediate object code, which is closer to machine code but not yet executable. Finally, a linker or similar tool converts the object code into machine code, which consists of binary instructions that the computer can directly execute .

In an IPO chart for calculating the area of a rectangle, the inputs are the length and width of the rectangle. The process involves multiplying these two values to compute the area. The output is the resulting value, which represents the area of the rectangle. This division into input, process, and output helps in clearly organizing the data requirements and the steps needed to achieve the desired result .

An IPO chart aids in programming problem-solving by organizing the analysis of a problem into three components: Input, Process, and Output. This helps clarify what data is needed, what operations need to be performed on the data, and what the expected outcomes are. For example, calculating the sum of two numbers involves inputs (the numbers), a process (adding them), and an output (the sum).

Flowcharts provide a visual representation of an algorithm, which helps programmers understand the logic and flow of a sequence of steps. By using standardized symbols and illustrations, flowcharts allow for clear communication of how a problem will be solved, making it easier to spot logical errors and improve the software development process .

Pseudo-code plays a significant role in algorithm planning by allowing programmers to draft the logical structure of a program using simple, human-readable statements. It enables the designer to focus on algorithm logic without worrying about language syntax, making it easier to translate into actual code later and ensuring a clear understanding of the algorithm among team members .

You might also like