0% found this document useful (0 votes)
38 views13 pages

M1 Technical 1

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)
38 views13 pages

M1 Technical 1

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/ 13

COLLEGE OF COMPUTER STUDIES AND MULTIMEDIA ARTS

CCS0006L
(COMPUTER PROGRAMMING 1)

EXERCISE

1
FAMILIARIZATION OF C++ ENVIRONMENT

Student Name / Group


Name: Leanne E. Baccay
Name Role
Members (if Group):

BSITWMA-TW04
Section:
MS. AIRA RUETAS
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]

II. COURSE LEARNING OUTCOME/S (CLO) ADDRESSED BY THE LABORATORY EXERCISE


 Solve computing problems using design tools that meets specific requirements. [CLO: 1]

III. INTENDED LEARNING OUTCOME/S (ILO) OF THE LABORATORY EXERCISE


At the end of this exercise, students must be able to:
 Familiarize an environment in creating a C++ program
 Create a simple program, compile and run it.

IV. BACKGROUND INFORMATION

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.

CCS0003L-Computer Programming 1 Page 2 of 13


A. Create a C++ project in Visual Studio 2019
1. From the main menu, choose File > New > Project to open the Create a New Project dialog box.
2. At the top right of the dialog box, set Language to C++ in "All languages", set Platform to Windows in "All
platforms", and set Project type to Console in "All project types".
3. From the list of options for project types, choose Console App then click Next.
4. In the next page, enter a name for the project, and specify the project location if desired.
5. Click the Create button to create the project.

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

ACTIVITY 1.1: Fun Run

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.

CCS0003L-Computer Programming 1 Page 3 of 13


fun1.cpp

Output of the Modified Program:

1. Run and compile the program. Enter 1981 as the input. Paste the screen output below.

2. Run and compile the program. Enter 2020 as the input. Paste the screen output below.

CCS0003L-Computer Programming 1 Page 4 of 13


fun2.cpp

Output of the Modified Program:

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.

ACTIVITY 1.2: Correct Me If I Am Wrong

CCS0003L-Computer Programming 1 Page 5 of 13


PROCEDURE:

1. Created a project named try then encode the C++ program below in try.cpp

2. Save the C++ program.


3. Build and run the program.
4. The compiler points to what line number?
Answer: ___Line 1________________________
5. Put # symbol before the “include” word. Compile and run again the program. What happened?
It points to what line number?
Answer: ______Line 6____________________
6. Put ; symbol after the statement “int n1,n2,s”. Compile and run again the program. What
happened? It points to what line number?
Answer: ___________Line 7________________
7. Change the << to >> in the statement “cin<<n1;”. Compile and run again the program. What
happened? Does it successfully execute the program?
Answer: ________Yes___________________
8. Type 10 as the first number and 5 as a second number. What is the screen output?
Screen Output: (Paste the screen output below.)

9. The program should add the two numbers. Is the result correct?

CCS0003L-Computer Programming 1 Page 6 of 13


Answer: _______No____________________
10. Change the – to + in the statement “s=n1– n2;” Compile and run again the program. What
happened? Does it successfully execute the program?
Answer: ____Yes_______________________
11. Type 10 as the first number and 5 as a second number. What is the screen output?
Screen Output:

12. Is the output 15?


Answer: ___Yes________________________
13. Copy and paste in the Program section below the modified program.

Program:

Sample Output:

ACTIVITY 1.3: Arrange Me

CCS0003L-Computer Programming 1 Page 7 of 13


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
F
B
B. E
D
A
C.

D.

E.

F.

Visual C++ Program Output

CCS0003L-Computer Programming 1 Page 8 of 13


Problem 2. Create a project named swap then create a program that swaps the two numbers entered
by the user.
Block of Codes Block of Codes
(in correct order)
A. F
D
B
C
B. G
E
A

C.

D.

E.

F.

G.

Visual C++ Program Output

CCS0003L-Computer Programming 1 Page 9 of 13


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
D
A
E
B
B.

C.

D.

E.

Visual C++ Program Output

CCS0003L-Computer Programming 1 Page 10 of 13


VI. QUESTION AND ANSWER

Directions: Briefly answer the questions below.

 What is IDE?

IDE is a software application to help the programmers to develop code.

 In running a program, what shortcut key should be pressed?

The shortcut key that should be pressed in running the program is f10.

 In compiling and running a program, what shortcut key should be pressed?

The shortcut key that should be pressed in running the program is f11.

 Discuss briefly syntax error and logical error.

Syntax error occurs when the programmer misused or forgets the characters. While the logical error
happens when the output is not successful.

CCS0003L-Computer Programming 1 Page 11 of 13


 In Activity 1.2, which line statement(s) consists of syntax error? How are you going to correct this
type of error?

In line 1,6, and 7 shows that there are missing or misused of characters. To avoid this kind of error,
make sure that you place the right characters and remember what they used for.

 In Activity 1.2, which line statement(s) consists of logical error? How are you going to correct this
type of error?

In line statement 10 shows that the number should be added not subtracted. To avoid this error you
should analyze your code that shows the right output.

VII. REFERENCES
 Abraham (2015). Coding for dummies. John Wiley and Sons: Hoboken, NJ
 Zak, D (2015). An Introduction to Programming with C++. 8th Edition
 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

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.

CCS0003L-Computer Programming 1 Page 12 of 13


The program Not all of the
Few of the
The program design selected
selected
design uses generally uses structures are
structures are
appropriate appropriate appropriate.
appropriate.
structures. The structures. Some of the
Program
overall program Program program
elements are
design is elements elements are
not well
appropriate. exhibit good appropriately
Program designed.
design. designed.
Design(x3)

All required There are few


All required
parts of the parts of the Most of the
parts in the
document are document are parts of the
document are
complete and missing but the document are
present and
correct(code, rest are missing and
correct but not
output of complete and incorrect.
Completeness complete.
screenshots) correct.
of
Document(x2)
Total

CCS0003L-Computer Programming 1 Page 13 of 13

You might also like