Professional Documents
Culture Documents
Fundamentals of Programming: Lab Task#3
Fundamentals of Programming: Lab Task#3
Lab task#3
Question 1:
Write a program to get input a number (i.e. is your age) form keyboard and check it.
Condition Message
age is less than 50 "You are pretty young!"
age is equal to 50 "You are old"
age is greater than 50 "You are really old"
Question 2:
If integer variable opCode has the value 1, read in or input double values for X and Y and
calculate and print their sum.
Assign a value to double variable cost depending on the value of integer variable
distance as follows:
Distance Cost
----------------------------------- ------------------
0 through 100 5.00
More than 100 but not more than 500 8.00
More than 500 but less than 1,000 10.00
1,000 or more 12.00
Question 3:
What is wrong with the following if statement (there are at least 3 errors). The indentation
indicates the desired behavior. (Check it either manually or by writing the whole code in a C++
source file in a complete C++ program)