PF Lab 3
PF Lab 3
Lab Manual
for
Programming Fundamentals
PROBLEM 1
Task 0:
My First Computer Program Creating a New Project
It’s time to start! Go ahead and open up Visual Studio from the desktop or start menu.
When you create an app in Visual Studio, you first create a project and a solution. For
this example, you’ll create a Windows console application.
• Create a project by pointing to New on the File menu, and then clicking
Project.
• In the Visual C++ project types pane, click Win32, and then click Win32
Console Application.
• The .cpp file appears in the Source Files folder in Solution Explorer, and the
file is opened in the Visual Studio editor. • In the file in the editor, type a
valid C++ program.
Task 1:
➢ Task 2:
Write a C++ program to print “Hello!! Welcome to the world of programming” on the
console.
➢ Task 3:
PROBLEM 2
Task1: Write a program that declares and initializes an integer. If the number is positive, print
"The number is positive."
Task2: Write a program that checks if a number is odd or even. The program should take an
integer input from the user and print either "The number is even" or "The number is odd."
Task3: Write a program that assigns a grade (A, B, C, D, or F) based on a student's score. Use
the following criteria:
90 and above: A
80 to 89: B
70 to 79: C
60 to 69: D
Below 60: F
Problem 3
Task 1: You're tasked to write a program that declares and initializes a number. Determine
whether this number lies within the range of 10 to 50 (both inclusive).
Task2: Given an age, determine if the person is a teenager. A teenager is someone whose age
is between 13 and 19 (both inclusive).
Task3: In a particular country, the legal age for voting is 18 and for driving is 21. Check if a
person is eligible for voting, driving, both, or none based on their age.
Task4: On a highway, the safe speed range for driving is between 45 mph and 70 mph. Write a
program that checks whether a car's current speed is safe.
Task5: A store is open if it's a weekday (where days are represented as 1 for Monday to 5 for
Friday) and the time is between 9 AM (inclusive) and 9 PM (exclusive). Determine if the store is
open based on user input for the day and time.