Professional Documents
Culture Documents
PF LAB4Tasks
PF LAB4Tasks
PF LAB4Tasks
Task #1: Write C++ program to allow the user to input his/her age. Then the program will show
if the person is eligible to vote. A person who is eligible to vote must be older than or equal to 18
years old.
Expected Output
Task #2: A student will not be allowed to sit in exam if his/her attendance is less than 75%.
Take following input from user:
Number of classes held
Number of classes attended.
And print
percentage of class attended
Is student is allowed to sit in exam or not.
Task # 3: Write a program that accepts three numbers from the user and prints "increasing" if the
numbers are in increasing order, "decreasing" if the numbers are in decreasing order.
Test Data
Input first number: 15
Input second number: 25
Input third number: 35
Expected Output:
Increasing order
Task # 5: Write a C++ program that takes a line of text from the user and prints only the first word
.
Task # 6: Write a C++ program that takes a single word from the user and prints only the first
charcter .
Task # 7: In the following program, explain why the value "6" is printed twice in a row:
Task #8: Take three numbers from the user and print the greatest number.
Test Data
Input the 1st number: 25
Input the 2nd number: 78
Input the 3rd number: 87
Expected Output:
The greatest: 87
Task # 9: Write a c++ program that accepts three numbers and prints "All numbers are equal" if
all three numbers are equal
Task #10
If
x=2
y=5
z=0
then find values of the following expressions:
a. x == 2
b. x != 5
c. x != 5 && y >= 5
d. z != 0 || x == 2
e. !(y < 10)