-Black Inspiration- -Telor-ceplox- -PROFIL- -Facebook- -Twitter- "* ikhsan_choco@ymail.com "*
Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!!----Stop Dreaming and Start Action Now...!! Jangan lupa kasih komentar demi kemajuan blog ini...!!!

14 Apr 2011

Menentukan tahun kabisat dengan Java

 Kemarin pas praktikum diminta dosen untuk membuat validasi tahun kabisat di program java, untung sebelumnya udah pernah buat dengan program C++ *yg saya posting sebelumnya. jadi tinggal mengingat-ingat lagi. Meskipun program ini dibuat dengan bahasa program java, tapi algoritmanya bisa juga dipake untuk bahasa program lainnya, misalkan php dan vb c++. Tinggal disesuaikan saja bahasa programnya. Langsung aja lihat codingnya:
CEKIDOT

import jeliot.io.*;

public class tatang {
  
   public void masuk(){
       System.out.println("Program Pemilihan tahun-tahun");
    System.out.println("tahun");
    a=Input.readInt();}
   public void tatang_tahun(){
     if (a%4==0){
       System.out.println("tahun kabisat");
       }
    else {
      System.out.print("bukan tahun kabisat");
      }
    }
    private int a;
    public static void main() {
     tatang x=new tatang();
     x.masuk();    
     x.tatang_tahun();
     }
}



 Sekian dan maturThank yuu.......
Jangan lupa kasih komentar demi kemajuan blog ini...!!!

13 Apr 2011

program kakulator sederhana c++

Dengan adanya program kalkulator , kita akan sangat terbantu terutama dalam hal hitung-menghitung. Sebenarnya, kita bisa membuat kalkulator tersebut dengan mudah, namun dalam versi dev c++ tentunya. Sebab, dev c++ memungkinkan kita untuk membuat program kalkulator dengan cepat dan menyenangkan asalkan Anda tahu konsep dasar tentang cara kerja kalkulator.
Contoh Program C++ Kalkulator  dapat anda lihat pada source kode di bawah. Contoh Program C++ di bawah menggunakan user input yaitu nilai-nilai diinputkan sendiri oleh user. Untuk Mencobanya silahkan copy paste source code Contoh Program C++ Kalkulator  berikut. CEKIDOT.

#include <cstdlib>
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;
class kakulator{
      public :
             double menu ();
             double kuadrat ();
             double akar ();
             double pangkat ();
             double modulus ();
             double logaritma();
             double logsepuluh ();
             double jumlah ();
             double kurang ();
             double kali ();
             double bagi ();
            
          
      private :
              double a,b,c,hslJ,hslK,hslKL,hslB,hslKD,hslA,hslP,hslM,hslL,hslLS;
              };
             
      double kakulator::menu(){
             int pil;
             cout<<"KAKULATOR SEDERHANA"<<endl<<endl;
             cout<<"MENU"<<endl;
             cout<<"silahkan milih operator"<<endl;
             cout<<"1.penjumlahan - 2.pengurangan - 3.perkalian - 4.pembagian - 5.kuadrat"<<endl;
             cout<<"6.akar        - 7.pangkat     - 8.modulus   - 9.logaritma  - 10.logsepuluh"<<endl<<endl<<endl;
             cout<<"masukan salahsatu pilihan";cin>>pil;
             while(!((pil==1)||(pil==2)||(pil==3)||(pil==4)||(pil==5)||(pil==6)||(pil==7)||(pil==8)||(pil==9)||(pil==10)||(pil==11))){//||(pil=='q')||(pil=='Q')))){
     cout<<"Pilihan yang anda masukkan salah!!!\nsilahkan coba lagi 1-7\n";
     cout<<">>Pilih Salah Satu : ";cin>>pil;   
     }
     switch(pil){
                 case 1 : jumlah();break;
                 case 2 : kurang ();break;
                 case 3 : kali (); break;
                 case 4 : bagi (); break;
                 case 5 : kuadrat ();break;
                 case 6 : akar ();break;
                 case 7 : pangkat ();break;
                 case 8 : modulus ();break;
                 case 9 : logaritma ();break;
                 case 10 : logsepuluh (); break;
               
                 }
                 }   
     double kakulator::jumlah (){
            cout<<"masukan angka :";cin>>a;
            cout<<"masukan angka :";cin>>b;
            hslJ=a+b;
            cout<<"hasil :"<<hslJ<<endl<<endl<<endl;
             menu();

            }
     double kakulator::kurang(){
            cout<<"masukan angka :";cin>>a;
            cout<<"masukan angka :";cin>>b;
            hslK=a-b;
            cout<<"hasil :"<<hslK<<endl<<endl<<endl;
             menu();
            }
     double kakulator::kali(){
            cout<<"masukan angka :";cin>>a;
            cout<<"masukan angka :";cin>>b;
            hslK=a*b;
            cout<<"hasil :"<<hslK<<endl<<endl<<endl<<endl;
           menu();
            }
     double kakulator::bagi(){
            cout<<"masukan angka :";cin>>a;
            cout<<"masukan angka :";cin>>b;
            hslB=a/b;
            cout<<"hasil :"<<hslB<<endl<<endl<<endl;
             menu();
             }
     double kakulator::kuadrat(){
           cout<<"masukan angka :";cin>>a;
            hslKD=a*a;
            cout<<"hasil :"<<hslKD<<endl<<endl<<endl;
             menu();
            
             }
            
     double kakulator::akar(){
            cout<<"masukan nilai :";cin>>a;
          hslA=sqrt (a);
            cout<<"hasil :"<<hslA<<endl<<endl<<endl;
             menu();
             }
     double kakulator::pangkat(){
            cout<<"masukan nilai :";cin>>a;
            cout<<"masukan pangkat :";cin>>b;
            hslP=pow(a,b);
            cout<<"hasil :"<<hslP<<endl<<endl;
            menu();
            }
     double kakulator::modulus(){
            cout<<"masukan angka :";cin>>a;
            cout<<"masukan pembagi :";cin>>b;
            hslM=fmod (a,b);
            cout<<"hasil :"<<hslM<<endl<<endl;
            menu();
            }
     double kakulator::logaritma(){
            cout<<"masukan nilai :";cin>>a;
            hslL=log (a);
            cout<<"hasil :"<<hslL<<endl<<endl<<endl;
            menu();
            }
     double kakulator::logsepuluh(){
            cout<<"masukan nilai :";cin>>a;
            hslLS=log10 (a);
            cout<<"hasil :"<<hslLS<<endl<<endl<<endl;
            menu();
            }
         
int main(int argc, char *argv[])
{
  kakulator x;
  x.menu();


    system("PAUSE");
    return EXIT_SUCCESS;
}
Jangan lupa kasih komentar demi kemajuan blog ini...!!!

12 Apr 2011

Menentukan Tahun kabisat dengan c++

 Sudah bisakah Anda mencari tahun kabisat dalam C++? Tahun kabisat adalah tahun yang habis dibagi 4 atau 400 tetapi tidak habis dibagi 100. Nah, dari penjelasan diatas sudah tentu kita mengetahui algoritma pembuatan program pencari tahun kabisat.

Gunakan statemen if untuk mencarinya. Jika habis dibagi 4, atau habis dibagi 400 dan tidak habis dibagi 100, maka tahun kabisat. Sekarang kita akan mencari berapa banyak tahun kabisat antara dua buah tahun yang diinputkan. Gunakan statemen for atau perulangan untuk yang satu ini.


Perhatikan syntax berikut ini:


#include <iostream.h>
#include <string.h>
#include <conio.h>

class Kabisat
{
  private:
    int l;
    char tahun[4];

  public:
    Kabisat();
    void hitungKabisat();
    friend istream &operator >> (istream &in, Kabisat &);
    friend ostream &operator << (ostream &out, Kabisat &);
};

int main()
{
  Kabisat x;

  cin >> x;
  cout << x;

  system ("pause");
  return EXIT_SUCCESS;

}


Kabisat::Kabisat(){

  cout << "MENENTUKAN TAHUN KABISAT" << endl;}

void Kabisat::hitungKabisat()
{
    if ( l % 4 != 0)
      strcpy(tahun,"Bukan Tahun kabisat");
    else
        strcpy(tahun,"tahun kabisat");

}

istream &operator >> (istream &in, Kabisat &masukan)
{
  cout<<" Memasukan tahun : " ;
  in>>masukan.l;

  return in;
}

ostream &operator << (ostream &out, Kabisat &tampil)
{
  tampil.hitungKabisat();
  out << tampil.l << "  "<< tampil.tahun << endl;
  return out;
}

3 Apr 2011

program to purchase fuel (program membeli bahan bakar)

 task group:
1. ikhsan koko irance (100180229)
2. fajar aditya (10018031)


 Well this time the program we get is a simple program purchases of fuel, so if we pay some money Ntar result is how many liters, if we ask too many liters will discharge the total price. How, from algorithm rude understand ..? Tell you what let's look a little beranalisis with the program algorithm.

Algorithm program: 
1. program called the input function.
2. (Fill command input function) displays to the user 3 choices of fuel to be purchased. if input dbawah 0 or above 3 then the program will continue to ask for input of fuel to the user. Asking the user to select purchase in liters or money. if the selection below 0 or 2 then the program will continue to ask for input. So there will be 2 times the selection is (1/2/3) and (half).  
3. program calls the function process. 4. (Command process function contents). program will remove the rest of the screen we chose earlier.

    
* If we choose 1 and then 1, then the program will display the number of liters pertamax of money we pay. if you choose 1 kemuadian 2, then the program will display the amount of money to be paid based on the input liters.
    
* If we choose 2 and then 1, then the program will display the number of liters of diesel fuel from the money we pay. if you choose 2 kemuadian 2, then the program will display the amount of money to be paid based on the input liters.
    
* If we choose 3 then 1, then the program will display the number of liters of premium from the money we pay. if you choose 3 kemuadian 2, then the program will display the amount of money to be paid based on the input liters.
How ..? understand the flow of the program ..? hehehe already common before we make a program must first understand the algorithm because the algorithm language is the most easily understood. Now we immediately see the source code:

#include
#include

using namespace std;

int main(int argc, char *argv[])
{

class spbu (){
friend ostream& opreator<<(ostream&,spbu&); friend istream& operator>>(istream&,spbu&);
public :
void banyak();
void pilihan();
void hitung_liter();
void hitung_harga();
private :
int harga;
int Biaya;
int a,b ;
float hasil ;
float premium ;
float solar ;
float pertamax ;
};
void banyak::liter(){
cout<<"Masukkan berapa liter yang dibutuhkan : "; cin>>x;
}
void banyak::pilihan(){
cout<<"pilih 1 untuk premium\n"<<<"pilih 2 untuk solar\n"<<<"pilih 3 untuk pertamax\n"<<<"Masukkan pilihan : "; cin>>y;
}
void banyak::hitung_liter(){
float i = 0.0;
while(i <= x){
i = i + 0.1;
cout<<
}
}
void banyak::hitung_harga(){
float hasil = 0.0;
float premium = 4500;
float solar = 6000;
float pertamax = 8000;
if(y == 1)
hasil = x * premium;
else if(y == 2)
hasil = x * solar;
else if(y == 3)
hasil = x * pertamax;
cout<<"harga : "<<
}
void main(){
spbu :
banyak.banyak();
banyak.harga();
banyak.hitung_liter();
banyak.hitung_harga();


system("PAUSE");
return EXIT_SUCCESS;
}

Java program to calculate the factorial (menghitung nilai faktorial dg java)

 Award as the value of factorial is the result of the multiplication of positive integers less than or equal to the value N. Writing is usually a factorial: n!

Now we will create a program to calculate factorial. A factorial in difinisikan as follows:

n!=n x(n-1)x(n-2)x......x 2 x 1


examples
:

2!= 2 x 1 =2
3!= 3 x 2 x 1 =6
4!= 4 x 3 x 2 x 1 = 24

Algoritma:

1. Masukkan (n)
2. bil <-- n
2. hasil=1
3.untuk bil>=1, maka bil-1
hasil <-- hasil* bil
4. tampilkan(hasil)

The following program :

import jeliot.io.*;


public class faktorial
{
public static void main (String[ ] args)
{
long limit = 20; // menghitung faktorial integer daeri 1 – 20
long faktorial = 1; // pendefinisian variabel faktorial

for (int i = 0; i <= limit; i++)
{
faktorial = 1;

for (int faktor = 2; faktor <= i; faktor ++)
faktorial *= faktor;
System.out.println (i + "!" + " adalah " + faktorial);
}
}
}


1 Apr 2011

Convert a numeric value to a letter with dev c + +(Konversi nilai angka ke Huruf dengan dev c++)


I will Determining Conversion numerical value to letters by dev C + +, before I would mennjelaskan algorithm in advance .....

Algorithm :

Conversion determine the numerical value to a subsection:
1.    Enter a numeric value.
2.    Determine the limit of the value of the letters.
3.    See if there are more or less input from the boundary.
4.   Show results overall.

Deklarasi:

Integer : nilai;

Deskrips:

Tuliskan (nilai)
Buat batasan nilai:
“A “ dari 80 sampai 100
“B“ dari 60 sampai 80
“C “ dari 40 sampai 60
“D “ dari 20 sampai 40
“E “ dari 0 sampai 20
If no input value is beyond the scope yag value, display the error on the income value.

Conversion to C + + programming language:
#include <iostream.h>
int main ()
{

int nilai;

cout<<"masukan nilai anda :";
cin >> nilai;


if ((nilai >80)&&(nilai <100))
 {
 cout << "A" << endl;
 }

else if ((nilai >60)&&(nilai <80))
{
cout << "B" << endl;
}

else if ((nilai >40)&&(nilai <60))
 {
 cout<<"C" << endl;
 }

else if ((nilai >20)&&(nilai <40))
{
cout << "D" << endl;
}

else if ((nilai > 0)&& (nilai < 20))
{
cout <<  "E" << endl;
}

else
{
cout << "masukan nilai anda salah!"<< endl ;
}

return 0;
}

Mohon masukan teman-teman apabila memiliki cara yang kebih baik, mari kita sama-sama belajar!

Terima kasih.