Object-Oriented Programming (COM326)

plumponionchipsΛογισμικό & κατασκευή λογ/κού

18 Νοε 2013 (πριν από 3 χρόνια και 4 μήνες)

61 εμφανίσεις

Object
-
Oriented Programming (COM3
26
)

L
ab Submission 1



Week 1:
Exercise
3

-

Sample C++ program


You have done the exercise
3

in week
1

and saved it in your u drive. Using
/modifying

the codes,
write a program that
displays the following lists



Group 1 Group 2


-------------------------------

beta =
2


beta =
3

2*0=0

3*0=0

2*1=2


3*1=3

2*2=4


3*2=6

2*3=6


3*3=9

2*4=8


3*4=12



Week 2:
Exercise

2



Finding the larger value using n
ested If…Else

You have done the exercise
2

in week
2

and saved it in your u drive. Using
/modifying

the codes,
write a program that finds the largest values among three. Test the program
with the following values:



Group 1 Group 2


----------------------------------------


{
-
3,
-
2, 0}

{5.5, 1.23, 3.39}



Week 3:
Exercise
4

-

P
attern

g
enerat
ion

using nested loops

You
have done the exercise
4

in week
3

and saved it in your u drive. Using
/modifying

the codes,
generate
s

the following patterns using nested looping techniques
.


Group 1 Group 2



-------------------------------------------------------

















.
.
.
.
.
.
.
.
.
.
]
,
[
j
i
G







.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
]
,
[
j
i
G



Week 4:
Exercise 3

-

Function with parameter and return values

You have done the exercise
3

in week
4

and saved

it in your u drive. Using
/modifying

the codes,
write a function
with three formal parameters that returns a value. Call the
function in the main program using three actual parameters. Test the program with the
following values:







Group 1 Group 2


----------------------------------------


{1
.5
, 2
.5
, 3
.0
},

{4, 5, 6}








c
s
b
s
a
s
s
A




*
4
1
, where


c
b
a
s



2
1
, {a, b, c} are
int
eger values.




Week 5: Exercise 2



Initialisation and d
ispla
ying a t
wo

dimensional array

You have done the exercise 2 in week 5 and saved
it
in your
u drive. Using the codes
,

initialize a 3x3 matrix given below:




1
1
1
1
1
1
1
1
1
3
3


A

and display t
he following matrices


Group 1 Group 2


---------------------------------------------------------




1
0
0
0
1
0
0
0
1
3
3


A




1
0
0
1
1
0
1
1
1
3
3


A