Académique Documents
Professionnel Documents
Culture Documents
DKC2306
Report Contents
Worksheet 1(a) ............................................................................................................................................. 2
Introduction .............................................................................................................................................. 2
Objectives ................................................................................................................................................. 2
Create a new project and file .................................................................................................................... 3
Exercise 1 .................................................................................................................................................. 7
Exercise 2 .................................................................................................................................................. 9
Exercise 3 ................................................................................................................................................ 11
Exercise 4 ................................................................................................................................................ 12
Exercise 5 ................................................................................................................................................ 13
Question 1 ............................................................................................................................................... 14
Question 2 (a) and (b) ............................................................................................................................. 16
Question 3 ............................................................................................................................................... 17
Worksheet 1(b) ........................................................................................................................................... 19
Introduction ............................................................................................................................................ 19
Objectives ............................................................................................................................................... 19
Exercise 1 ................................................................................................................................................ 20
Exercise 2 ................................................................................................................................................ 21
Exercise 3 ................................................................................................................................................ 22
Exercise 4 ................................................................................................................................................ 23
Exercise 5 ................................................................................................................................................ 24
Exercise 6 ................................................................................................................................................ 25
Exercise 7 ................................................................................................................................................ 26
Exercise 8 ................................................................................................................................................ 27
Question 1 ............................................................................................................................................... 28
DKC2306
Worksheet 1(c)............................................................................................................................................ 29
Introduction ............................................................................................................................................ 29
Objectives ............................................................................................................................................... 29
Exercise 1 ................................................................................................................................................ 30
Exercise 2 ................................................................................................................................................ 31
Exercise 3 ................................................................................................................................................ 32
Exercise 4 ................................................................................................................................................ 33
Exercise 5 ................................................................................................................................................ 34
Exercise 6 ................................................................................................................................................ 35
Exercise 7 ................................................................................................................................................ 36
Exercise 8 ................................................................................................................................................ 37
Question 1a ............................................................................................................................................. 38
Question 1 (b) ......................................................................................................................................... 39
Worksheet 1(a)
Introduction
This worksheet will guide and introduce the C / C++ programming environment. This simple program will
show how to create a program using the C / C++ language.
Objectives
DKC2306
2. New project was created by clicking on FILE > New > Project.
DKC2306
3. Visual C++ is chose and Win32 Console Application. The file was renamed as Lab1.
DKC2306
5. The option is set as show in the picture above. Clicking Finish will proceed to main windows.
6. New Item was created by right-clicked on the Source folder in the Solution Explorer Tab.
DKC2306
DKC2306
Exercise 1
3. Build Solution process was done by clicking on BUILD > Build Solution.
MUHAMAD FIRDAUS BIN ADNAN (K12115049)
DKC2306
5. The Code is started to run by selecting Start Without Debugging under DEBUG menu.
DKC2306
Exercise 2
1. New item was created under Source File by right-clicking on it and select Add > New item.
DKC2306
10
DKC2306
Exercise 3
11
DKC2306
Exercise 4
12
DKC2306
Exercise 5
13
DKC2306
Question 1
14
DKC2306
15
DKC2306
16
DKC2306
Question 3
1. The source code was written back in proper line and arrangement.
17
DKC2306
18
DKC2306
Worksheet 1(b)
Introduction
This worksheet will guide and introduce several basic types of variable which the C++ can recognize. All
variables in program must be declared in a program before it can be used. Output statement is
statements used to display information on screen or other output devices.
Objectives
19
DKC2306
Exercise 1
20
DKC2306
Exercise 2
21
DKC2306
Exercise 3
22
DKC2306
Exercise 4
23
DKC2306
Exercise 5
24
DKC2306
Exercise 6
25
DKC2306
Exercise 7
26
DKC2306
Exercise 8
27
DKC2306
Question 1
28
DKC2306
Worksheet 1(c)
Introduction
This worksheet will guide and introduce input statement and constant in C++ programming.
Objectives
29
DKC2306
Exercise 1
4.
30
DKC2306
Exercise 2
31
DKC2306
Exercise 3
32
DKC2306
Exercise 4
33
DKC2306
Exercise 5
34
DKC2306
Exercise 6
35
DKC2306
Exercise 7
36
DKC2306
Exercise 8
37
DKC2306
Question 1a
38
DKC2306
Question 1 (b)
Celsius
50
55
60
65
70
Fahrenheit
122
131
140
149
158
Answer:
39