M3 P2 Formative
M3 P2 Formative
M3 P2 Formative
CCS0006L
(COMPUTER PROGRAMMING 1)
EXERCISE
3-2
FAMILIARIZATION OF C++ ENVIRONMENT
Name Role
Members (if Group):
Section:
AM01
Professor:
RICAFRENTE, MICHAEL
I. PROGRAM OUTCOME/S (PO) ADDRESSED BY THE LABORATORY EXERCISE
● Apply knowledge through the use of current techniques and tools necessary for the IT profession. [PO: I]
● Solve computing problems using design tools that meets specific requirements. [CLO: 1]
Problem 1. Create a project named digits then create a program that asks a user a 3-digit number and
displays the hundreds, tens and ones digits of the inputted number.
Block of Codes Block of Codes
(in correct order)
A. #include <iostream>
using namespace std;
B. int main()
{
C.
int number, hundreds, tens,
ones;
D. cout << "enter a 3-digit
number:";
cin >> number;
E. hundreds = number / 100;
return 0;
}
int main()
{
int number, hundreds, tens, ones;
cout << "enter a 3-digit number:";
cin >> number;
return 0;
}
B. int main()
{
int a, b, c;
a = b;
b = c;
C.
c = a;
D.
cout << "enter value of a: ";
cin >> a;
cout << "enter value of b: ";
E. cin >> b;
F.
int main()
{
int a, b, c;
a = b;
b = c;
c = a;
cout << "after swaping a: " << a << "b: " << b;
return 0;
Problem 3. Create a project named leap then create a program that identifies whether the inputted year
is a leap year or not.
Block of Codes Block of Codes
(in correct order)
A. #include <iostream>
int main()
{
B. int year;
cout <<"enter a year: ";
C. if ((year % 4) == 0)
{
cout << "leap year";
else
{
cout << "not a leap
year" << endl;
E. }
return 0;
}
Visual C++ Program Output
enter a year: leap year
#include <iostream>
int main()
{
int year;
cout <<"enter a year: ";
if ((year % 4) == 0)
{
cout << "leap year";
}
else
{
cout << "not a leap year" << endl;
}
return 0;
}
● Cadenhead, R et. Al. (2016). C++ in 24 Hours, Sams Teach Yourself (6th Edition).Sams Publishing
● McGrath, M. (2017). C++ programming in easy steps (5th ed.). Warwickshire, United Kingdom: Easy
Steps Limited
● Tale, T. (2016). C++: The Ultimate Beginners Guide to C++ Programing. CreateSpace Independent
Publishing Platform
● http://cs.uno.edu/~jaime/Courses/2025/devCpp2025Instructions.html