LOOPING
Looping is an action to
do similar things many times, for example showing the words "electrical
engineering UAD" a hundred times.
Conditional looping "check-run": WHILE
The structure of looping
while has the following form:
|
In this
case the statement will run continuously for the condition true. If the initial
state value condition then statement will not be executed at all.
Conditional
looping
“periksa-jalankan”: DO-WHILE
|
This form
of the command above to read:
Kerjakan pernyataan selama
kondisi bernilai true.
In this
structure the statement at least will be done one time. The statement must have
been carried out, as a first step the looping structures do-while working on
the statement, then followed the testing against the condition. This structure
is particularly suitable for programs that don't need testing first before
working on the statement.
Looping with
FOR
|
Structure for used for looping with number of repetitions have
been ascertained.
Details:
Initialization: Give the
initial value on a variable control
Conditions: to control
the looping, continued/end
Change: State of change
control values, i.e. addition or subtraction.
III. DISCUSSION OF THE EXPERIMENT AND STEP
Conditional looping
“periksa-jalankan”: WHILE
Program VI-1
|
Results running program

|
Baris
|
Keterangan
|
|
1.
|
Is a program to call the header files in the form of library
operations stream.
|
|
2.
|
Is a program to call the header files in the form of library
operations console (monitor & keyboard)
|
|
3.
|
The main functions of the program in C++
|
|
4.
|
Limit characters in the "name" is 80 characters.
|
|
5.
|
The Program outputs in the form of an integer or integer value.
|
|
6.
|
Is variable. When the remove then would instantly
"done"
|
|
7.
|
Stated condition Y/y
|
|
8.
|
Is a great Program and display the output statement
|
|
9.
|
Is a great program and the input statement
|
|
10.
|
The statement display output on the "name"
|
|
11.
|
Is a great Program and display the output statement
|
|
12.
|
Is a program specialized for character input and repeat
instruction
|
|
13.
|
To provide a range or enter on view
|
|
14.
|
Is a great Program and display the output.
|
Conditional looping
“jalankan-periksa”:DO-WHILE
|
Results running program

Counting cacah ++ is to count up/down a numeric value with a certain multiples..
|
Baris
|
Keterangan
|
|
1
|
Is a program to call the header files in the form of library
operations stream.
|
|
2
|
The main functions of the program in C++ is a function of the
main
|
|
3
|
Indicates that the integer-shaped counter and start from 0
|
|
4
|
Input Program to calculate the number and average value of the
numbers which we input after the program is run.
|
|
5
|
The Program output statement
|
|
6
|
The Program output statement
|
|
7
|
To count up a numeric value in this memcacah rising by
increments of 1
|
|
8
|
The Program output statements and counter input
|
|
9
|
Input Program statements
|
|
10
|
Summation functions
|
|
11
|
The value in the do is greater than or equal to 0
|
|
12
|
Average function
|
|
13
|
The Program output statement
|
|
14
|
The Program output statement
|
|
15
|
The Program output statement
|
Break iteration:
BREAK & CONTINUE
Program VI-3
|
Display the results of the
execution of the program
So the function Syimbol//is to
translate all the characters after//as a comment or did not enter the
executable compiler.After removing the two syimbol//Produces the following
display

So the function keyboard break is
issued a compiler execution of program structure after a certain condition is
met. Replace the keyboard functionality break with continue, resulting in a
display as follows
So keyboard functionality
continue is to direct execution to a round, the next iteration in the loop
statement or resume execution compilers from the structure of the program after
a certain condition is met.
|
Baris
|
Keterangan
|
|
1.
|
Is a program to call the header files in the form of library
operations stream
|
|
2.
|
as a counter variable to indicate the amount of writing C++
already displayed, initially filled with 0
|
|
3.
|
Program the output statement
|
|
4.
|
to count up a numeric value in this memcacah rising by
increments of 1
|
|
5.
|
Program the output statement
|
|
6.
|
translate all characters after//as a comment or did not enter
the executable compiler
|
|
7.
|
removing the eksekussi compiler from the structure of the
program after a certain condition is met.
|
|
8.
|
output Program statement
|
|
9.
|
conditions of less than 10
|
|
10.
|
Program the output statement
|
FOR looping
Program VI-4
|
Display the results of the execution of the program

|
(a)for (i=10; i<=20;
i++) {
(b)for (i=1; i<=20;
i++) {
(c)for (i=1; i<=20;
i=i+2) {
Display the
results of the execution of the program
a. the influence that occurred for (i=10; i<=20; i++) {

b. the influence that occurred for
(i=1; i<=20; i++) {

c. the influence that occurred for
(i=1; i<=20; i=i+2) {

The influence that
occurred for the third such change is
a. the influence going
to for (i = 10; i < = 20; i ++) {
For a numeric value
equal to 10, then to a value less than or equal to 20 to 10 using scintillation
multiples 1 (order)
b. influences that occur
to for (i = 1; i < = 20; i ++) {
For a numeric value
equal to 1, then to a value less than or equal to 10 to 1 using scintillation
multiples 1 (order)
c. the influence going
to for (i = 1; i < = 20; i = i + 1) {
For a numeric value
equal to 1, then to a value less than or equal to 20 to 1 using scintillation
multiples of 2
looping FOR: Tabel Perkalian
Program VI-5
|
Display the results of the
execution of the program

The replacement of the number 5
in parentheses on function setw () into 3 and 8 are as follows.
Display the results of the execution of the program after a change in the
number 3.

Display the results of the
execution of the program after a change in the number 8.

So the function setw () is to set
the width of a data display and Function make the look in right align with the
width determined by the existing values in parentheses.
I.
Task
1. Flowchart
To calculate the number and
average
a.
Use looping
structures WHILE
b.
Use looping structures DO-WHILE
Use looping structures DO-WHILE
|
||||
|
||||
1. Compute the number and average
a.
Use looping
structures WHILE
Display the
results of the execution of the program using a looping structure WHILE

b.
Use looping
structures DO-WHILE

Display the
results of the execution of the program using a looping structure DO-WHILE

2. temperature conversion Table
The use of looping Structures
DO-WHILE for creation of temperature conversion table from Celsius to
Farenheit, Reamur, and Kelvin temperature, ranging from 0 ºc to 100 ºc by 5ºc.
![]() |
Display the
results of the execution of the program using a looping structure DO-WHILE

Conclude
1. the structure of
looping while, do ... while, for and a description of the syntactic structure
while, do ... while, for
a. while looping
Structures, the statement will run continuously for the condition nernilai
true. If the initial state value condition then statement will not be executed
at all.
b. structure of looping
the do ... while, working on the statement as long as the condition is true.
working on the statement, then followed the testing against the condition.
c. structure of looping
Structures for, for used for looping with number of repetitions have been
ascertained.
2. Flowchart is a
sequence of processes in the system by showing media tool input, output and the
type of storage medium in the process of data processing. Flowchart is also a
sequence of instructions that is described with a specific symbol to solve
problems in a program.
II.
REFERENSI
Ø Modul
Praktikum Dasar Pemrograman Kartika Firdausy, S.T.,M.T

