Postingan

Menampilkan postingan dari April, 2016

PROGRAM MEMBALIKKAN KATA

Gambar
#include <iostream> #include <conio.h> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main(int argc, char** argv) {     char a[30];     int i,j;         cout<<"masukkan Kalimat :";     cin.getline(a,30);     i=strlen(a);     cout<<"\nKalimat Setelah di Balik :";     for(j=i;j>=0;j--){         cout<<a[j];     }     getch();     return 0; }  untuk no 1-2 pengantarprogram.blogspot.co.id untuk no 3 fafa145.blogspot.co.id

hal 541

Gambar
Problem : Sort an array ascending order using a selection sort. Dev c++ : #include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main(int argc, char** argv) {     int i, j, max, temp;     int data[10];     cout<<"---Selection Sort---"<<endl;     cout<<"Masukkan banyak data=";     cin>>max;     for(i=1;i<=max;i++){         cout<<"Masukkan data ke-"<<i<<" : ";         cin>>data[i];     }     cout<<" Data Awal :";     for(i=1;i<=max;i++){         cout<<data[i]<<" ";     }     for(i=1;i<max;i++){         for(j=i+1;j<=max;j++){  ...

Kasus 6.2

Gambar
Kasus 6.2. Carilah nilai deviasi standar dari n buah data. Dev c++ : #include <iostream> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; void sqrt(int x[]){     int n;     cout<<"masukkan jumlah data:";     cin>>n;     x[n];     float std ;int rata=0, jumlah=0;     for(int i=0;i<n;i++){         cout<<"masukkan jumlah data :"<<i<<" : ";         cin>>x[i];     }     for(int i=0;i<n;i++){         jumlah=jumlah+sqrt(x[i]);     }     std=sqrt(jumlah/(n-1));     cout<<"STD : "<<std; } int main(int argc, char** argv) {     int x[100];     sqrt(x);  ...

KASUS 6.1

Gambar
Kasus 6.1. Carilah rata-rata dari n bilangan bulat dengan menggunakan array. Penyelesaian dengan menggunakan dev c++ : #include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; void rata(int bil []){     int n;     cout<<"Masukkan jumlah data:";     cin>>n;     bil[n];     int rata=0;     int hasil=0;     for(int i=0;i<n;i++){         cout<<"masukkan data ke "<<i<<" : ";         cin>>bil[i];     }     for(int i=0;i<n;i++){         hasil=hasil+bil[i];     }     rata=hasil/n;     cout<<"jumlah total: "<<hasil<<endl;     cout<<"rata-rata : "<<rat...

4.2

Gambar
Problem : Given a set of n students examination marks(in the range 0-100) make a count of the number of students that obtained each possible mark. Penyelesaian dengan menggunakan dev c++ : #include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main(int argc, char** argv) {     int a[100];     for(int i=0; i<=100; i++){         a[i]=i;         cout<<"a["<<a[i]<<"] := a["<<a[i]+1<<"]"<<endl;     }     return 0; }   untuk 4.3-4.4 buka di  fafa145.blogspot.com   untuk 4.5-4.6 buka di  http://pengantarprogram.blogspot.co.id/

4.1

Gambar
Problem : Rearrange the elements in an array so that they appear in reverse order. penyelesaian dengan menggunakan dev c++ : #include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main(int argc, char** argv) {     char balik[10]="123456789";     cout<<"Kata Awal: ";     for(int i=0;i<10;i++){         cout<<balik[i];     }     cout<<endl;     cout<<"Di Balik :";     for(int i=10; i>=0; i--){         cout<<balik[i];     }     return 0; }

KASUS 5.6

Gambar
Diberikan deret Fibonacci sebagai berikut : 1, 1, 2, 3, 5, 8, … • Buatlah fungsi yang menghitung suku ke-n dari deret Fibonacci dengan menggunakan cara rekursif. • Analisis : • Suku ke-n dari deret Fibonacci diperoleh dengan rumus : fibonacci(n) = fibonacci(n-1) + fibonacci(n-2)    dengan nilai awal untuk n=1 dan n=2 berharga 1. Menggunakan C++ #include <iostream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int fibonacci(int n){ if (n==1 || n==2)return(1); else return(fibonacci(n-1)+fibonacci(n-2)); } int main(int argc, char** argv) { int i,n; cout<<"Masukan Batas Suku =";cin>>n; for(i=1;i<=n;i++) cout<<fibonacci(i)<<","; return 0; } Tampilan Menggunakan Raptor

KASUS 5.5

Gambar
Pertanyaan : Fungsi faktorial rekursif untuk mencari nilai n! Menggunakan C++ #include <iostream> #include <string> using namespace std; void factorial(int n,int x,int hasil){ if(x>n){ cout<<"Factorial "<<n<<" adalah "<<hasil<<endl; } else{ hasil=hasil*x; x=x+1; factorial(n,x,hasil); } } int main() { int hasil; int n; int x; cout<<"Masukan nilai factorial : "; cin>>n; x=1; hasil=1; factorial(n,x,hasil); return 0; } Tampilan Raptor
Gambar
Ass..W..W.., Kali ini akan memembahas program angka fibonacci menggunakan C++ dan RAPTOR. 1.) Masukan suku dari angka fibonacci. 2.) Dan setelah itu akan mengeluarkan output  angka fibonacci dari suku yang di masukan. 1.) C++  #include <iostream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int fibonacci(int n){     if (n==1 || n==2)return(1);     else return(fibonacci(n-1)+fibonacci(n-2)); } int main(int argc, char** argv) {     int i,n;     cout<<"Masukan Batas Suku =";cin>>n;     for(i=1;i<=n;i++)     cout<<fibonacci(i)<<",";     return 0; } 2) Raptor :  tag : 

KASUS 5.3

Gambar
engan menggunakan fungsi ln dan exp, buatlah fungsi untuk menghasilkan nilai x y Dengan menggunakan sifat logaritma : ln(x y ) = y*ln(x) exp(ln(x y )) = exp(y*ln(x)) x y = exp(y*ln(x)) Menggunakan Program C++  Menggunakan Program Raptor Menggunakan Program C++          #include <iostream> #include <math.h> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ float pangkat(int x, int y){     return (exp(y*log(x))); } int main(int argc, char** argv) {     float hasil=0,a,b;     cout<<"Menghitung Hasil Pangkat"<<endl;     cout<<"Masukan Nilai 1 =";cin>>a;     cout<<"Masukan Nilai 2 =";cin>>b;     hasil=pangkat(a,b);     cout<<a<<" Pangkat "<<b<<"...

KASUS 5.2

Gambar
Buatlah fungsi yang menentukan nilai terbesar dari 2 bilangan bulat. Menggunakan Program C++ Menggunakan Program Raptor Menggunakan C++ #include <iostream> using namespace std; int cetak(int x, int y){     if (x>y){         cout<<"A>B"<<endl;     }else if (x<y){         cout<<"A<B"<<endl;     }else {         cout<<"A=B"<<endl;     } } /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) {     int a,b;     cout<<"Masukan Nilai A =";cin>>a;     cout<<"Masukan Nilai B =";cin>>b;     cetak(a,b);     return 0; }

Kasus 5.8

Gambar

Refleksi minggu ke enam

Pertemuan keenam membahas tentang Rekursif dan Iteratif. 1. Rekursif, yaitu Fungsi pemanggilan dirinya sendiri ( if, if else ) 2. Iteratif, yaitu fungsi perulangan  ( for, while, do while ) Macam-macam metode Rekursif :  Going Down Recursion (rekursi menurun), yaitu parameter menurun nilainya sampai dicapai kasus berhenti Going Up Recursion (rekursi menaik), yaitu parameter menaik nilanya sampai dicapai kasus  berhenti Two Half (rekursi separuh-separuh), rekursif dibagi menjadi 2 bagian, dimana setiap bagian juga merupakan subprogram rekursif Pertemuan keenam ini saya kurang paham dengan materi rekursif. 

BAB2 nomor 4

Gambar
Dev c++ : #include <iostream> #include <stdio.h> #include <conio.h> using namespace std; class c{     public :         c ();           void input();           void proses();               private :         int a,b,hasil; }; c::c(){     cout<<"ntah apa nama ny\n\n"; } void c::input(){     cout<<"nilai pertama : ";     cin>>a;     cout<<"nilai kedua : ";     cin>>b;     cout<<"_______________________________________________\n\n"; } void c::proses(){         cout<<"OPERASI-OPERASI ARITMATIKA"<<endl;         hasil=a+b;     cout<<a<<"+"<<b<<"= "...

BAB2 nomor 3

Gambar
Dev c++ : #include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main(int argc, char** argv) { int a,b,c,d,jumlah,hasil,punya; cout<<"masukan ribuan = "; cin>>a; jumlah=a/1000; cout<<"masukan ratusan = "; cin>>b; hasil=b/100; cout<<"masukan puluhan = "; cin>>c; punya=c/10; cout<<"masukan satuan = "; cin>>d; cout<<"hasil  "<<jumlah<<hasil<<punya<<d;         return 0; } Raptor :

BAB2 nomor 2

Gambar
Dev c++ : #include <stdio.h> using namespace std; void pecahan(); main(){        pecahan(); } void pecahan(){        int a,b,l,t;        printf("masukkan pembilang : ");        scanf("%d",&a);        printf("masukkan penyebut : ");        scanf("%d",&b);        t = a/b;        l = a%b;        if (a%b == 0)        printf("Bilangan (%d/%d) \ndi sederhanakan menjadi  %d ",a,b,t);        else if (a%b != 0)        printf("Bilangan (%d/%d) \ndi sederhanakan menjadi (%d %d/%d)",a,b,t,l,b);            } Raptor :

BAB2 nomor 1

Gambar
Dev c++ : #include <iostream> #include <conio.h> using namespace std; main() { long int jam,menit,detik,s,sisa; cout<<"Program Konversi Detik Ke Jam, Menit & Detik\n"; cout<<"============================================\n"; cout<<"masukkan Detik : "; cin>>detik; cout<<endl; jam=detik/3600; sisa=detik%3600; menit=sisa/60; s=sisa%60; cout<<detik ; cout<<" Detik = "; cout<<jam ; cout<<" Jam "; cout<<menit ; cout<<" Menit "; cout<<s ; cout<<" detik "; cout<<endl; return 0; } Raptor :

BAB1 nomor 5

Gambar
Dev c++ : #include <iostream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) {     int pil;     cout<<"Pilihan Menu Cafe Expresso : \n";     cout<<"\t1. Menu Makanan\n";     cout<<"\t2. Menu Minuman\n";     cout<<"Masukkan Pilihan : ";cin>>pil;     switch(pil){         case 1 :             cout<<" Makanan : \n";             cout<<"1. Nasi Goreng \n";             cout<<"2. Mie Goreng/Rebus\n";             cout<<"3. Tempura\n";             cout<<"4. Kentang Gor...

BAB1 nomor 4

Gambar
DEv c++ : #include <iostream> #include <windows.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std;   int main(int argc, char** argv) {    int pil;    int r;    float L;    float kel;    float vol;    char back;        do{   cout<<" Masukkan Pilihan Anda"<<endl;    cout<<"\t1. Luas Lingkaran."<<endl;    cout<<"\t2. Keliling Lingkaran."<<endl;    cout<<"\t3. Volume Bola.\n"<<endl;    cout<<"Masukkan Pilihan : ";    cin>>pil;       switch(pil){     case 1 :    cout<<" Anda akan menghitung luas lingkaran."<<endl;    cout<<" Masukkan jari-jarinya : ";    cin>>r;    L=3.14*r*r...

BAB1 nomor 3

Dev c++ : Raptornya nyusul