Tuesday, 15 May 2012

REFLECTION LEARNING TO EIGHT MEETING Alpro


In this eighth meeting of Alpro we were discussing the problems of yesterday UTS, we also learn about the array a little more shall dimensi.Kurang dg is related to the material they will be.

index 1 2 3
A 3 4 0
A [3] <------- A [2]
A [2] <------- A [1]
A [1] <------- 0


1 2 3 4
A -> 1 2 3 4
1 +4: 2 = 2 +1
A [2] + A [2 +1]: 2


1 2 3
A -------> 1 2 3 1 +3: 2 = 2


In everyday life, we can find a group of objects in place tertentu.Sebagai example: a row of books on the shelves, VCD is placed on the cupboard, which contains a class of students and sebagainya.Kita can give the number as a place in a book objek.Misalkantitled Harry Potter: Chamber of Secret is in the fifth row from left kiri.Kita be considered as an initial position (sometimes called offset) numbering.
We can identify each element of each site (hereafter we call the array or array) in atas.Misalkan just above the name of the array element pointed to is someone data.Kita 3 with the data [3]. But we can also point to the element by element to 0sampai 4.For do that of course we will not say data [0], data [1], ..., data [4]. Therefore where we can use the sequence up to replace the structure for:
for (int i = 0: i <= 4, i + +)
cout << data [i];
means we take each element of the element to 0 to the elements of the 4 variables that represent the variable i perjalnan this go round.
Array manipulation is not just showing it. We can for example add any data elements on the numbers that can be used is 3.Pernyataan
for (int i = 0; i <= 4, i + +)
data [i] = data [i] +3;
Statement for the above may mean well for all values ​​of i valid ... ". So for the above statement can be diartika as:
For each of the data from the data to 0 to add the value data to 4 with 3.Kitapun can also calculate how much all of the above values ​​in the array data using the statement:
total = 0;
for (int i = 0; i <= 4, i + +)
total = total + data [i];

0 comments:

Post a Comment

.

.

.

.
Design by BlogSpotDesign | Ngetik Dot Com