1 / 8

PERTEMUAN _7

~ Asliyani_unm10@yahoo.co.id. PERTEMUAN _7. STRUKTUR LOOPING. ~ Asliyani_unm10@yahoo.co.id. A  1. A  A + 1. Pemutaran kembali, terjadi ketika mengalihkan arus diagram alur kembali ke atas, shg bbrp alur berulang bbrp kali.

ros
Download Presentation

PERTEMUAN _7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ~ Asliyani_unm10@yahoo.co.id PERTEMUAN _7 STRUKTUR LOOPING

  2. ~ Asliyani_unm10@yahoo.co.id A  1 A  A + 1 Pemutaran kembali, terjadi ketika mengalihkan arus diagram alur kembali ke atas, shg bbrp alur berulang bbrp kali. (1)Variabel A diberi harga 1(2)Var. A berubah hrg menjadi 2 (3)Var. B diberi hrg sebesar hrg A dikalikan hrg A (4)Harga B dicetak Lalu ke (2), (3),(4) & kembalilagi ke (2) dstnya... Jadi yang akan tercetak adalah harga-harga 4,9,16, ... dst B  A * A Kembali lg?

  3. ~ Asliyani_unm10@yahoo.co.id Bentuk umum penulisan proses LOOP : 1. Statement While 2. Statement Do.....While 3. Statement FOR a. Statement FOR Positif b. Statement FOR Negatif c. Statement FOR bersarang ( Nested Loop )

  4. ~ Asliyani_unm10@yahoo.co.id Statement While Perulangan akan terus dilaksanakan selama syarat tersebut terpenuhi. Bentuk Umum : while (syarat) pernyataan ; Contoh : Int bil=1; While(bil<=5) cout<<bil; ++bil; bil = bil+1 Output : 1 2 3 4 5

  5. ~ Asliyani_unm10@yahoo.co.id 2. Statement Do.....While Perulanganakandilaksanakanterlebihdahuludanpengujianperulangandilakukanbelakangan. BentukUmum: do pernyataan; while (syarat); Contoh : Intbil=2; do cout<<bil; bil+=2; While (bil<=10); Output : 2 4 6 8 10

  6. ~ Asliyani_unm10@yahoo.co.id 3. Statement For BentukUmum: For (inisialisasi; syaratpengulangan; pengubahnilai) pemberiannilaiawalmengaturnaik/turun Contoh : for (a =0; a<=10; ++a) perulanganpositif (+1) for (a =0; a<=10; a+=2) perulanganpositif (+2) for (a=10; a>=0; --a) perulangannegatif

  7. ~ Asliyani_unm10@yahoo.co.id Nested For Perulangan for di dalam perulangan for lainnya. BentukUmum: For (inisialisasi; syaratpengulangan; pengubahnilai) { For (inisialisasi; syaratpengulangan; pengubahnilai) { perintah ; } }

  8. ~ Asliyani_unm10@yahoo.co.id SELESAI

More Related