Home
Left Sidebar Homepage
Homepage Layout 2
Sliders
NivoSlider
VideoSlider
Shortcodes
Columns
Columns Full-width
Images Shortcodes
Video Shortcodes
Shortcodes
Typography
Portfolio
Portfolio with Sidebar
One Column
One Column (Big Image)
Full-width Portfolio
One column
Two Column
Two Column (Light)
Three Column
Three Column (Light)
Standart WP Gallery
Blog
Contact page
Help Videos
Algoritma Program
Tuesday, July 31, 2012
PENGENALAN FUNGSI C++
1:14 AM
By Unknown
Array
,
C++
,
Dasar Pemrograman Komputer
,
Fungsi
,
Kondisi
,
Operator
,
Perulangan
,
Praktikum Dasar Pemrograman Komputer
,
Semester2
0 comments
1. PROTOTYPE FUNCTION (Deklarasi Fungsi)
Contoh 1 :
/*fungsi*/ #include
//deklarasi fungsi int cari(int n1, int n2); void prin (int m); //main function main () { int i = 5; int j = 7; int k; k=cari(i,j); prin(k); return 0; } //<-- function definition here int cari (int a, int b) { if (a > b) return a; else return b; } void prin(int m) { printf("Bilangan terbesar adalah:%d\n", m); } //end function definition
Contoh 2 :
#include
//deklarasi fungsi int calcSalesTax(float purchase, float taxRate=0.1); //main function main () { float purchase; cout<<"Masukkan pembelian : "; cin>>purchase; float tax = calcSalesTax(purchase); cout<<"Pajak pembelian adalah ; "<
2. FUNGSI REKURSIF (Fungsi Yang Memanggil Dirinya Sendiri)
Contoh 1 :
/*aplikasi rekursif pada faktorial*/ #include
int faktorial(int a) { if (a==1) return 1; else return a*faktorial(a-1); } void main() { int x; cout<<"Mencari Niai Faktorial\n"; cout<<"Masukkan nlai n = "; cin>>x; cout<<"Faktorial "<
Contoh 2 :
/*aplikasi rekursif pada fibonacci*/ #include
long fibo(long a) { if(a==1 || a==2) return 1; else return fibo(a-1) + fibo(a-2); } void main() { int x; cout<<"Mencari Nilai Fibonacci\n"; cout<<"Masukkan nlai n = "; cin>>x; cout<<"Fibonacci "<
0 comments:
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Search
Categories
Ainurrahman
Algoritma Dan Struktur Data
Array
Arsitektur Dan Organisasi Komputer
Belajar Dan Pembelajaran
C++
Dasar Pemrograman Komputer
Elektronika
Fungsi
Kecerdasan
Kondisi
Kurikulum Pendidikan Kejuruan
Linux
Operator
Perulangan
Praktikum Dasar Pemrograman Komputer
Semester1
Semester2
Sistem Informasi
Sistem Operasi
sitemap
Teknologi Informasi
Tips n Trik PC
TKJ
Popular Posts
Contoh Algoritma Flowchart 2
Kurikulum Inti dan Kurikulum Muatan Lokal [Topik 8]
Program Membalik Kata [ARRAY] of Char
Program Perawatan PC
Program Matriks 3x4 [ARRAY]
Program Kalkulator Sederhana [Fungsi]
Praktikum Nested If
Flowchart Modul 4 Operasi Kondisi
Program x + y + z = 20
TRANSPOSE MATRIKS 3x3 [ARRAY] FOR C++
About Me
Unknown
View my complete profile
0 comments: