(M1-TECHNICAL) Done
(M1-TECHNICAL) Done
CCS0006L
(COMPUTER PROGRAMMING 1)
EXERCISE
1
FAMILIARIZATION OF C++ ENVIRONMENT
TN07
Section:
Sir. Hadji Tejuco
Professor:
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]
Microsoft Visual C++, usually shortened to Visual C++ or MSVC, is the name for the C++, C, and assembly
language development tools and libraries available as part of Visual Studio on Windows. Visual C++ can be used to
write anything from simple console apps to the most sophisticated and complex apps for Windows desktop, from
device drivers and operating system components to cross-platform games for mobile devices, and from the smallest
IoT devices to multi-server high performance computing in the Azure cloud.
B. Build a Project
Once you have entered all of your source code, you are ready to build.
On the menu bar, choose Build > Build Solution from the Build menu or just press Ctrl+Shift+B.
C. Run a Code
You can now run your program.
On the menu bar, choose Debug > Start without debugging or just press Ctrl + F5.
V. LABORATORY ACTIVITY
PROCEDURE:
1. Create two projects namely fun1 and fun2.
2. Encode the following C++ programs in fun1.cpp and fun2.cpp respectively.
3. Build and run the program.
4. Illustrate the output of the program.
1.Run and compile the program. Enter 1981 as the input. Paste the screen output below.
fun2.cpp
1.Run and compile the program. Enter 1231 as the input. Paste the screen output below.
2.Run and compile the program. Enter 23432 as the input. Paste the screen output below.
PROCEDURE:
1. Created a project named try then encode the C++ program below in try.cpp
9. The program should add the two numbers. Is the result correct?
Answer: no, it is not correct
Sample Output:
Directions: Arrange the block of codes to form the C++ program that will satisfy the given
problem specification. Encode your answer in Visual Studio C++ then build and run. Paste your C++
program in Visual C++ Program column and the sample output in the Output column.
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. C.
#include<iostream>
using namespace std;
B. F.
int main()
{
C.
int number, hundreds, tens, ones;
cout << "Enter a 3-digit number: ";
D. cin >> number;
E.
hundreds = number / 100;
number = number % 100;
E.
B.
tens = number / 10;
F. ones = number % 10;
D.
cout << "Hundreds digit: " << hundreds<<endl;
cout << "Tens digit: " << tens << endl;
cout << "Ones digit: " << ones << endl;
A.
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. C.
#include <iostream>
using namespace std;
D.
int main()
B. {
int year;
cout << "Enter a year: ";
cin >> year;
C. A.
if ((year % 4) == 0)
{
cout << "Leap Year";
}
D. E.
else
{
cout << "Not a Leap Year" << endl;
}
B.
return 0;
E.
}
What is IDE?
An Integrated Development Environment (IDE) is a software application that provides
comprehensive facilities for software development. It combines tools like a code editor,
compiler, debugger, and an integrated terminal. By integrating features such as code editing,
building, testing, and packaging into a single, easy-to-use tool, IDEs significantly boost
developer productivity. They are commonly used by programmers and software developers to
streamline their programming workflow and make the development process smoother.
Syntax error - a mistake in code that violates the programming language's rules and prevents it from
executing correctly.
Logical error - a bug in a program that causes it to operate incorrectly, but not to terminate abnormally.
In Activity 1.2, which line statement(s) consists of syntax error? How are you going to correct this
type of error?
RUBRIC:
Criteria 4 3 2 1 Score
A completed
A completed solution is An incomplete
A completed
solution is implemented solution is
solution runs
tested and runs on the required implemented
without errors.
but does not platform, and on the required
It meets all the
meet all the uses the platform. It
specifications
specifications compiler does not
and works for
nd/or work for specified. It compile and/or
all test data.
all test data. runs, but has run.
Solution(x5) logical errors.