1 / 8

Pertemuan 15 & 16

Pertemuan 15 & 16. ARRAY.  Pengenalan Array Array adalah Tipe terstruktur yang terdiri dari sejumlah komponen-komponen yang mempunyai tipe sama.array mempunyai jumlah komponen tetap yang dibatasi dengan pemberian index. Array ada dua jenis : 1.array dimensi 1

Download Presentation

Pertemuan 15 & 16

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. Pertemuan 15 & 16

  2. ARRAY Pengenalan Array • Array adalahTipeterstruktur yang terdiridarisejumlahkomponen-komponen yang mempunyaitipesama.arraymempunyaijumlahkomponentetap yang dibatasidenganpemberian index. • Array adaduajenis: 1.array dimensi 1 1.array dimensi 2 array dimensiSatu Bentukumum: Tipe_DataNama_Variabel[index] Keterangan: • Type Data : Untukmenyatakan type data yang digunakan. • index : Untukmenyatakanjumlahmaksimumelemen array. Array dimensi 2 BentukUmum: • Tipe_DataNama_Variabel[index-1][index-2] Keterangan: • Type Data : Untukmenyatakan type data yang digunakan. • Index-1 : Untukmenyatakanjumlahbaris • Index-2 : Untukmenyatakanjumlahkolom

  3. Contoh

  4. Tampilansetelahdirun

  5. Listing: Lihatdi notepad Listing_array

  6. Array dimensi II Baris 1, dankolom 1 baris Baris 2, Kolom 3 Kolom

  7. Lihat listing di notepad…listing array II

  8. Catatan: file header iomanipadalah file header yang digunakanuntukmengaturtampilandilayar.. • setiosflagsuntukmengatur format keluaran,fungsiiniharusberpasangandenganperintahcout(),danharusmengikutsertakan file header iomanip.h • setwfungsinyauntukmengaturlebartampilanlayarpadasuatuvariabeltertentu. • setw(6)-->mempuyailebar 6 karakter • karna index array dimulaidai 0 makabanyaknya data = jumlahelemen – 1 • Jikabanyaknya data >= jumlahelemen array maka data yang dihasilkanmenjaditidak valid

More Related