0% found this document useful (0 votes)
3 views19 pages

Module 3 Programing

The document discusses flowcharts, highlighting their advantages such as ease of creation and effective communication, as well as disadvantages like complexity in representation and time consumption. It also covers logical and relational operators used in programming for decision-making and comparisons. Additionally, it provides examples of flowchart applications, including decision boxes and grading systems.

Uploaded by

Hacchi
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)
3 views19 pages

Module 3 Programing

The document discusses flowcharts, highlighting their advantages such as ease of creation and effective communication, as well as disadvantages like complexity in representation and time consumption. It also covers logical and relational operators used in programming for decision-making and comparisons. Additionally, it provides examples of flowchart applications, including decision boxes and grading systems.

Uploaded by

Hacchi
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/ 19

Previously…

Programming tools
✔ Flowchart
✔ Flowchart Symbols
✔ Single Alternative Selection Structure
✔ Dual Alternative Selection Structure
Advantages of Flowchart
Listed are a few advantages of Flowcharts:
✔ Easy to make.
✔ Communication becomes effective and easy to understand.
✔ Mistakes can be easily identified.
✔ Analysis becomes effective.
✔ Debugging becomes possible.
✔ Logics can be easily interpreted.
Disadvantages of Flowchart
A few disadvantages of Flowcharts are as follows:
✔ Difficulty in presenting complex programs and tasks.
✔ No scope for alteration or modification.
✔ Reproduction becomes a problem.
✔ It’s a time-consuming process.
✔ Difficult to understand for people who don’t know flowchart symbols.
Logical Operators
Are used to combine relational operators to give more complex
decisions.

AND OR

NOT
Logical Operators

AND Commonly used


logical operators
OR

A logical operator
that negates the
NOT result of the
Boolean value
Logical Operators
Activity no. 4
What would be the result of conditions A, B, and C when using the AND and OR
operator?
Condition a Condition b Condition c a AND b AND a OR b OR c
c
F F F
T F T
T T F
F F T
T T F
T F T
T F F
T T T
Relational Operators
Allow for assignment and enable comparisons to be made. They are
used in condition testing.
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
== Is equal to
!= Not equal to
<> Not equal to
Activity no. 5
Assume that you have variables called X and Y. What would be the results of the
conditions if we were to compare them with different values and different relational
operators?
X Y X<Y X>Y X <= Y X >= Y X == Y X != Y

5 17

18 4

12 12

30 31
Multiple Decision Boxes
✔ Can often times be combined into a single box.
✔ There are times, however, when you have to be very specific with
the conditions that you have to put in.
Example:
Create a flowchart that asks the user enter a number from 1 – 3. If 1 is
entered, print “Hello”; if 2 is entered, print “Hi”; and if 3 is entered,
then print “Bye”. Otherwise, print “Invalid.”
Create a flowchart Multiple Decision Boxes Example
that asks the user Start
enter a number from x == Yes Disp
x=0
1 – 3. If 1 is entered, 1? “Hello”
No
print “Hello”; if 2 is Get x x == Yes Disp “Hi”
entered, print “Hi”; 2?
Stop
No
and if 3 is entered, x == Yes
Disp “Bye”
then print “Bye”. No
3?

Otherwise, print Disp


“Invalid”
“Invalid.”
Using Decision Box with Ranges
✔ Use a sequence of decision blocks starting with either the lowest or
highest value in each range of values you are using to make your
selections..
Example:
Create a flowchart that would print the name of the supervisor under a certain department number.
Department Number Supervisor
1-3 Mr. X
4-7 Mr. Y
8-9 Mr. Z
Example: Using Decision Box with Ranges
1st Solution
Example:
Start
Create a flowchart that
would print the name of the Dept Yes
Disp “Mr.
supervisor under a certain <= 3? X”
Dept = 0
department number. No
Department No Supervisor Dept Yes Disp “Mr.
Get Dept Y” Stop
1-3 Mr. X <= 7?

4-7 Mr. Y No
Disp “Mr.
8-9 Mr. Z Z”
Example: Using Decision Box with Ranges
2nd Solution
Example:
Start
Create a flowchart that
Yes
would print the name of the Dept
Disp “Mr. Z”
>= 8?
supervisor under a certain Dept = 0
department number. No
Department No Supervisor Dept Yes
Disp “Mr. Y” Stop
Get Dept >= 4?
1-3 Mr. X
4-7 Mr. Y No
Disp “Mr. X”
8-9 Mr. Z
Activity no 6:
Draw a flowchart that will print the student’s letter grade given the following specifications :

90 – 100 = A
80 – 89 = B
70 – 79 = C
60 – 69 = D
below 60 = F
REFERENCES
Website:
✔ Fungsi Motherboard Processor Memori Dan Harddisk | Computer hardware, Computer hardware store,
Computer Pinterest. https://www.pinterest.ph/pin/88594317657692933/?mt=login
✔ Unit 4 - Hardware & Ergo - Davids BTA30 Portfolio 2016 Sites.google.com.
https://sites.google.com/site/davidsbtaportfolio/unit-4---hardware-ergo.
✔ Computer Software Icon #229946 - Free Icons Library. Icon-library.com.
https://icon-library.com/icon/computer-software-icon-14.html
✔ https://www.programiz.com/cpp-programming
✔ https://www.rapidtables.com/code/text/ascii-table.html
✔ https://www.lucidchart.com/pages/what-is-a-flowchart-tutorial#section_6
REFERENCES
Textbooks:
✔ Zak, Diane, Introduction to Programming with C++, C & E Publishing c2011
✔ Bronson, Gary J., C++ for Engineers and Scientists, Course Tech c2010
✔ Lambert, Kenneth, Fundamentals of C++ and data structures, 2009, Cengage
✔ Bronson, Gary J, C++ for engineers and scientists, 2010, Course Technology
✔ Deitel, PJ, C : how to program, 2009, Pearson Education, G,
--- END ---

You might also like