SERING DIBACA

3 dimensi Acer Acer Aspire One album foto Anak-anak Android Anti Malware anti nyamuk Anti Virus Anti Virus Gratis Antivirus Aplikasi Handphone audio Audio and Video Award background powerpoint gratis belajar tajwid berita Bisnis Online Browser Budidaya C/C++ cara download video Contoh proposal usaha Converter Crack CSS cursor gratis Desain Design design tombol Desk Top Desktop DesktopWidget Document download background powerpoint download cursor gratis download manager download murotal Downloader Drive Driver E-Commerce Ebook edit foto Editing Editor Video EditorSound Education Emulator film gratis FPS Free Games free templates gadget Game Game Adventure game gratis Game Mini Game Racing Game RIP Game Sport GameLokal Gamemini Adventure Gamemini Arcade Gamemini Racing Gamemini Strategy GameStrategy Hack Tools Handphone Handphone Qwerty Terbaru Harga c300 Town Harga iPod Nano Harga Nokia C3 harga smartphones hasil sergur hot Hot News HTML humor Icon intel Internet Internet Tool iPod Nano terbaru Iseng Islami Islamic Software Java Javascript kamus Karya Photoshop Koleksi kuis Kumpulan Cerita Rakyat Kustomisasi Linux manipulasi foto media player membuat album foto membuat animasi memory card kingston Microsoft Windows Motivasi Motorola Movie Mp3 Multimedia Music Netbook dual core Netbook Murah Nokia C3 Nokia N8 Nokia terbaru Nokia WP 7 nonton film gratis Notebook Terbaru Office Operating System OS Other PC Game Pemrograman Penghasil Dollar Perpres Peta Photo Photo Editing Photoshop dasar PHP Picture Ponsel Samsung Portable Programing Promosi Blog PSX PSX2 Recovery Resep Masakan RPG RTS Ruby ScreenSaver screensavers Security Security dan Antivirus SEO Contest Seputar Kerja Seputar Seks Serial Key Simulation Sistem Operasi Sistem Tools situs film gratis smartphones sms gratis sms idul fitri soal tes cpns Software Software Edit Foto spesifikasi iPod Nano Tafsir Al Misbah teks efek template powerpoint gratis templates gratis themes Tips Tips Blog Tips Software Tools Trik Komputer Tutorial Tutorial PowerPoint Uncategorized Unik Utilities Utility Video Video Converter Virus Wallpaper winamp terbaru Windows 7 Windows 8 Windows XP

Minggu, 19 Juni 2011

Contoh Penggabungan Perulangan, Array, dan Fungsi Pada C++

Selamat datang kembali di blog saya. Sudah lama saya tidak posting, yah, kebetulan akhir-akhir ini saya agak sibuk. Oke, kali ini saya ingin share tentang contoh penggunaan perulangan, array, dan juga function pada satu program.



Sebenarnya contoh ini saya tujukan untuk mahasiswa amikom yang sedang menempuh mata kuliah pemrograman terstruktur. Tapi kalau kiranya pembaca juga membutuhkannya silahkan saja dibaca. :)

Oke, langsung saja, berikut adalah source codenya :

/*===================================================================
=====================================================================
==================                            =======================
===============   Author : Bintang Catur Putra   ====================
==================                            =======================
=====================================================================
===================================================================*/



//Preprosesor
#include <stdio.h>
#include <conio.h>


//Fungsi penghitung luas.
int luas (int p, int l)
{
    return p * l;
}


//Fungsi utama.
main()
{
    //Pendeklarasian variabel yang dibutuhkan.
    int p[100], l[100], ulang;

    printf("PROGRAM PENGHITUNG LUAS PERSEGI PANJANG\n\n");
    printf("Masukan banyaknya perulangan (max 100) = ");
    scanf("%d", &ulang);
   
    //Proses input panjang dan luas yang berulang.
    for (int i = 0; i < ulang; i++)
    {
        printf("\nPersegi panjanjang ke - %d\n", i + 1);
        printf("Masukan panjang\t= ");
        scanf("%d", &p[i]);
        printf("Masukan lebar\t= ");
        scanf("%d", &l[i]);
    }
   
    printf("\n");
   
    //Proses menampilkan hasil.
    for (int i = 0; i < ulang; i++)
    {
        printf("Persegi panjanjang ke - %d luasnya adalah = %d\n", i + 1, luas(p[i], l[i]));
    }
    getch();
}


atau source yang lebih rapi download disini.

Tidak ada komentar:

Posting Komentar