Selasa, 06 Desember 2011

MAIN PROGRAM & SUBPROGRAM (FUNCTION & PROCEDURE)

MAIN PROGRAM adalah kumpulan perintah yang merupakan bagian utama program, karena bagian ini yg pertama kali dikerjakan saat program dijalankan.

SUBPROGRAM adalah kumpulan perintah yg independent (berdiri sendiri) dan dijalankan saat dipanggil oleh main program atau subprogram lain.

Ada 2 jenis Subprogram yaitu FUNCTION dan PROCEDURE.

FUNCTION adalah Subprogram yg nama functionnya merupakan variable penampung hasil (return value) dari function yg bersangkutan.

PROCEDURE adalah subprogram yg dijalankan dengan statement CALL.

CONTOH :

Hitung  X = -> N diinputkan

FLOWCHART


PROGRAM VBSCRIPT HTML

<html>
    <head>
        <script language="VBS">//SUBPROGRAM
            function pangkat(parameter1)
                dim hasil

                hasil = 1

                for p=1 to 3
                    hasil  = hasil*parameter1
                next

                pangkat = hasil
            end function
        </script>
        <script language="VBS">//SUBPROGRAM
            function faktorial(parameter2)
                dim hasil
               
                hasil = 1
                for l=1 to parameter2
                    hasil = hasil*l
                next

                faktorial = hasil
            end function
        </script>
    </head>
    <body>//MAIN PROGRAM
        <script language="VBS">

            n=inputbox("masukkan N")
            for i=1 to N
                pembilang = pangkat(i)
                penyebut = faktorial(i)
                x=x+(pembilang/penyebut)
            next

            document.write(x)

        </script>
    </body>
</html> 



4 komentar:

Unknown mengatakan...

mas, sekalian buatin dua contoh terakhir yang diberikan oleh beberapa asdos...kan belum ada flowchart dan pseudocode-nya.

terimakasih

vince kao
(upgad.org)

Dferdi.antn mengatakan...

pak

Blogger mengatakan...

According to Stanford Medical, It's really the ONLY reason women in this country get to live 10 years longer and weigh on average 42 lbs less than we do.

(By the way, it has totally NOTHING to do with genetics or some secret exercise and EVERYTHING to do with "HOW" they are eating.)

P.S, What I said is "HOW", and not "what"...

CLICK on this link to determine if this brief quiz can help you decipher your true weight loss possibility

Anonim mengatakan...

Play online casino games for real money with no deposit bonus
Online gambling is a great way of making money from your own hard-earned cash. You'll 바카라 사이트 get extra 온카지노 coins and other 샌즈카지노 rewards to add to your casino's

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | GreenGeeks Review