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

Activity - Decision-Making Adventure

Uploaded by

DAKSI
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 views2 pages

Activity - Decision-Making Adventure

Uploaded by

DAKSI
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/ 2

To: CC102 - FUNDAMENTALS OF PROGRAMMING Students

From: Mark L. Mascardo


Date: November 20, 2024
Subject: Activity - "Decision-Making Adventure"

Objective:

To practice writing decision-making statements using if, if-else, else-if, and switch-case
statements in C++.

Instructions:

1. Scenario: You are creating a simple text-based adventure game where the player has to
make decisions based on different conditions.
2. Problem 1: Using if statement
Write a program that asks the user for their age and prints whether they are a child (under
12), a teenager (12-18), or an adult (19 and above).
Example:
o If the age is 15, the program should output: "You are a teenager."
3. Problem 2: Using if-else statement
Write a program that asks the user if they want to go to the cinema or stay at home. If the
user chooses "cinema," print a message saying "Enjoy the movie!" If the user chooses
"home," print "Enjoy your time at home!"
o If the user types something else, output "Invalid input!"
4. Problem 3: Using else-if statement
Write a program that asks the user to input a number between 1 and 7 (inclusive), and
print the name of the corresponding day of the week (1 = Sunday, 2 = Monday, etc.). If
the user inputs a number outside the range, print "Invalid number!"
Example:
o If the user enters 3, the program should output: "Wednesday."
5. Problem 4: Using switch-case statement
Write a program that asks the user to choose a number between 1 and 5 and displays a
different message based on the number chosen:
o 1: "You chose the first option!"
o 2: "You chose the second option!"
o 3: "You chose the third option!"
o 4: "You chose the fourth option!"
o 5: "You chose the fifth option!"
o For any number outside the range, output: "Invalid choice."

Requirements:

 Use the appropriate decision-making statement (if, if-else, else-if, switch-case) as


specified in each problem.
 Ensure that your program handles user input and outputs the correct result based on the
given conditions.
Example of expected output for Problem 1:

You might also like