-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...!!!

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.

program c++ konversi detik untuk menampilkan jam menit dan detik

Program yang pernah saya buat dengan bahasa C berikut adalah beberapa program yang pernah dosen saya beri. Semoga bermanfaat, perhatikan alur logikanya

Ini adalah program mengubah banyak detik menjadi bentuk jm : mnt : dtk.
Pertama, user memasukan banyak jumlah detik, lalu akan menampilkan tampilan seperti misalkan 1 jam, 23 menit, 20 detik.
berikut ini adalah codenya yang saya buat dengan IDE Dev-C++.

 
#include <iostream.h>
#include <conio.h>
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;
}
 
Kurang jelas atau ada yang salah, silakan comment… matur thankyu 

31 Mar 2011

Konversi C++ to Java

 khir-akhir ini sering sekali ketika praktikum kita menggunakan program jeliot. nah kita juga masih awam bagaimana cara konversi program c++ ke jeliot??
secara garis besar konversi c++ ke jeliot itu mirip dengan ketika kita pertama kali kita belajar c ++

langkah 1
: kita mulai membuat program dasar seperti program untuk menghitung penjumlahan a dan b l
angkah ke 2 :kita pahami aja perubahan dari bahasa c++ ke java.
misal cout<<"masukkan nilai a :"; menjadi System.out.print("masukkan nilai a :");
cin>>a; menjadi  a=Input.readInt();
setelah itu kita rubah saja semua program diatas dengan konversi javanya
langkah ke 3 :dari program diatas kita coba kembangkan ke fungsi-fungsi.
 
 
lBahasa C++
#include
#include 

void main() {
    int A[10] = {1,2,3,4,5,6,7,8,9,10};
    int n = 10;
    cout << "Nilai array asal : ";
    for (int i=0; i<n; i++)
        cout << "Nilai indeks ke-[" << i << "] adalah " << A << endl;
    getch();
}
in jeliot
import jeliot.io.*;

public class array {
   public static void main()
{
 int[] A = {1,2,3,4,5,6,7,8,9,10};
 int n = 10;
 System.out.print("Nilai array asal : ");
 for (int i =0; i<n; i++)
 {
  System.out.print("Nilai indeks ke-[");
  System.out.print(i);
  System.out.print("] adalah ");
  System.out.print(A[1]); //karena menunjuk alamat
  System.out.print("\n");
 }

}
}