1 / 6

Fungsi & Prosedur

Fungsi & Prosedur. Fungsi dengan nilai balik tanpa parameter. Dibuat untuk menyelesaikan suatu permasalahan yang pada akhirnya hasil dari fungsi itu di kembalikan . Jika dilihat secara garis besar peran fungsi dengan nilai balik itu sebagai suatu variabel.

thor
Télécharger la présentation

Fungsi & Prosedur

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. Fungsi & Prosedur

  2. Fungsidengannilaibaliktanpa parameter • Dibuatuntukmenyelesaikansuatupermasalahan yang padaakhirnyahasildarifungsiitu di kembalikan. Jikadilihatsecaragarisbesarperanfungsidengannilaibalikitusebagaisuatuvariabel.

  3. Fungsidengannilaibaliktanpa parameter TipenilaibalikNamaFungsi Isi Fungsi *Type nilaibalik HARUS SAMA dengan type data variabel yang di return.

  4. Contoh Short hitungNilai() { return 100; } Void main() { cout<<hitungNilai(); short A=hitungNilai(); cout<<A; }

  5. PemangilanFungsidenganNilaiBalik • BerbedadenganProsedure, fungsidengannilaibalikinibiasanyatidakdipangiltanpadidampingiolehvariabel lain atautanpapernyataanuntukmengakseshasildariFungsi.

  6. PemangilanFungsidenganNilaiBalik • Dengan di dampingivariabel lain. A=hitungNilai(); atau A=(hitungNilai()+1+2)/3; • Diaksesolehpernyataancout. cout<<hitungNilai(); atau cout<<(hitungNilai()+1+2)3;

More Related