Module 3 Programing
Module 3 Programing
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
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?
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 ---