Professional Documents
Culture Documents
Lab 1 Week 5: Objectives
Lab 1 Week 5: Objectives
Lab Exercises
LAB 1 WEEK 5
Objectives
By the end of this lab session, you will be able to:
1. design a selection structure in solving a problem,
2. apply the concept of selection structure in developing a C++ program, and
3. apply good programming principles, desk checking and debugging.
Activity #1
Enter
pH
True False
pH==7
?
True False
“Neutral” pH<7?
“Very
Alkaline”
Figure 1
-1
TAB1013 Structured Programming
Lab Exercises
Activity #2
Write an if statement for the table below. Assign -1 to lumens when the value of
watts is not in the table.
Activity #4
Write a C++ program that contains an if statement that may be used to compute
the area of a circle (area = π* radius* radius), or circumference of a circle
(circumference=2 * π* radius) or a triangle (area = 1/2 x base x height). Display “Invalid
User Input” if the user entered other letters. Note that side, radius, base and height
must be greater than zero.
-2