skip to main | skip to sidebar

Sedikit Ilmu Yang Berguna

  • Entries (RSS)
  • Comments (RSS)
  • Home
  • About Us
  • Archives
  • Contact Us

Tuesday, April 19, 2011

bilangan 3 dan 5

Posted by randiadma at 12:04 AM
#include <iostream.h>

#include <conio.h>



class bilangan

{

public:

int proses();

private:

int i;

};

int bilangan::proses()

{

cout<<"Program Mencetak Bilangan yg Habis dibagi 3 dan 5";

cout<<" antara 1 sampai 100 : \n";



for(int i=1; i<=100; i++)

{

if(i % 3==0)

{cout<<i<<endl;}

else(i % 5==0);

{cout<<i<<endl;}

}



}



int main()

{

bilangan x;

x.proses();



getch();

}
0 comments
Email This BlogThis! Share to X Share to Facebook

deret

Posted by randiadma at 12:03 AM
#include <iostream.h>

class hitung
    {
    public:
     int proses();
     void input();
    private:
     int n;
     float rumus,jumlah,total;
    };

    void hitung::input()
    {
     cin>>n;
     cout<<endl;
    }
    int hitung::proses()
    {
     jumlah=0;
     total=0;
     rumus=-1;

     for(int j=1; j<=n; j++)
     {
     rumus=(rumus*(-1));
     total=rumus/j;
     jumlah+=total;
     if(j==1)
     cout<<"("<<total<<")";
     if(j>1)
     cout<<"+("<<total<<")";
     }
    cout<<endl<<endl<<"hasil penjumlahan deret = "<<jumlah;
    return jumlah;
    }

    int main()
    {
    cout<<"program sederhana menghitung jumlah dari rumus 1-(1/2)+(1/3)-(1/4)+...+(1/n)"<<endl<<endl;
    cout<<"tentukan nilai n : ";
    hitung deret;
    deret.input();
    deret.proses();
   
    return 0;
    }
0 comments
Email This BlogThis! Share to X Share to Facebook

rekursif

Posted by randiadma at 12:00 AM
A.ITERATIVE TO REKURSIVE CONVERSION
   
    Iterative Step:
for(int i=0;i<5;i++)
cout<<“mencoba rekursi\n”;
Rekursive Step:
void coba(int i)
{if(i==5)
{}
else
cout<<“mencoba rekursi\n”;coba i+1;
}
main()
{int i=0;
coba(i);
}

B.REKURSIVE TO ITERATIVE

Rekursive Step:
void coba(int i)
{if(i==5)
{}
else
cout<<“mencoba rekursi\n”;coba i+1;
}
main()
{int i=0;
coba(i);
}
Iterative Step:
for(int i=0;i<5;i++)
cout<<“mencoba rekursi\n”;
C. ANALISIS

For example, the function is called with value i = 0 so for the first we must check is i = 5 {if(i==5) or not, and if its have a same value its will be out.
In reality, i is not same with 0 so, please add i with 1. And the condition now become i = 2.
In next line, we show the value of i. Next, called rekursive function with value i = 2.
That steps is repeating until rekursive function calling with value i = 5.
For now, the if condition is true and that make the function out (return) and continue the command after calling rekursive function with i = 5. Then print out value i.
After print out value i then rekursive function will be out again, and go a head to the command after calling rekursive function where the value before is i = 4. And thats repeating until the value i = 0, thats the first calling rekursive function.
This is the calling rekursif function ilustrated in Indonesia:
Langkah ke :
1. i = 4 ; mencoba rekursi
2. i = 3 ; mencoba rekursi
3. i = 2 ; mencoba rekursi
4. i = 1 ; mencoba rekursi
5.i  = 0 ; mencoba rekursi
Jika di panggil i=5 akan keluar,sebaliknya dengan operasi rekursif ke iteratif
0 comments
Email This BlogThis! Share to X Share to Facebook

Sunday, April 17, 2011

BBM

Posted by randiadma at 8:16 PM
1 #include <cstdlib>
2 #include <iostream>
3
4 using namespace std;
5
6 class pombensin{
7 public:
8 void awal();
9 void proses();
10 void liter();
11 void rupiah();
12 private:
13 int pilih;
14 double masukan,keluaran;
15 };
16
17 void pombensin::awal(){
18 cout<<”Pilihan anda :\n”;
19 cout<<”1. LITER\n”;
20 cout<<”2. RUPIAH\n”;
21 cin>>pilih;
22 proses();
23 }
24
25 void pombensin::proses(){
26 if(pilih==1){system(“cls”);liter();}
27 else if(pilih==2){system(“cls”);rupiah();}
28 else{cout<<”Pilihan tidak ada,!\n”;}
29 }
30
31 void pombensin::liter(){
32 cout<<”\n\nLITER\n\n”;
33 cout<<”Mau beli berapa liter,?\n”;
34 cout<<”-> “;
35 cin>>masukan;
36 keluaran=masukan*4500;
37 cout<<”Uang yang harus dibayar : “<<keluaran<<” rupiah”<<endl;
38 }
39
40 void pombensin::rupiah(){
41 cout<<”\n\nRUPIAH\n\n”;
42 cout<<”Mau beli berapa rupiah,?\n”;
43 cout<<”-> “;
44 cin>>masukan;
45 keluaran=masukan/4500;
46 cout<<”Anda membeli bensin : “<<keluaran<<” liter”<<endl;
47 }
48
49 int main(int argc, char *argv[])
50 {
51 pombensin pastipas;
52 pastipas.awal();
53
54 system(“PAUSE”);
55 return EXIT_SUCCESS;
56 }








Program ini untuk mengetahui seberapa banyak  Anda harus membayar saat membeli bensin atau berapa liter bensin yang anda beli,,

penjelasan tentang program ini adalah tentang memilih pilihan. Kemudian nama fungsi seperti pada langkah 8 sampai dengan 11.  Anda harus mendeklarasikan tipe data dan variabel yang Anda inginkan (langkah 13 dan 14). Menutup kelas pombensin dengan tanda }; seperti pada langkah 15.

langkah 17, pernyataan yang harus merupakan pernyataan tentang pesan pada pengguna yang harus memilih membeli berapa liter atau berapa rupiah.
langkah 25 jika pernyataan lain yang terjadi.  tentang mana yang harus dipilih, dalam liter atau rupiah?

  jika pengguna memilih membeli dalam liter, lanjut ke langkah 31 sampai 38  tetapi jika dalam rupiah kemudian lanjut ke semua langkah 40. Hasil akhirnya  pada langkah 51 di int main.
0 comments
Email This BlogThis! Share to X Share to Facebook

Tuesday, April 12, 2011

tugas deret suku

Posted by randiadma at 10:26 PM
#include <iostream.h>

#include <conio.h>



class Suku {

public :

int proses();

private :

int n;



};



int Suku::proses() {

cout << "Sampai berapa suku ? ";

cin >> n;

for (int i=0; i<=n; i++)

{

cout<<"1/"<< i<<" + ";

}

}



int main()
{ 
Suku x;

x.proses();



getch();

return 0;

}
0 comments
Email This BlogThis! Share to X Share to Facebook

alpro3

Posted by randiadma at 10:24 PM
#include <iostream.h>
#include <conio.h>

class kpk
{

public:
    int input();
   void output();

private:
    int a,b,c;
   int nilai;
};

int kpk::input()
{
    cout<<"Masukkan Nilai  A : "; cin>>a;
    cout<<"Masukkan Nilai  B : "; cin>>b;
    nilai=0;
{
    for(int x=1;x<=b;x++)
{
    nilai=nilai+a;

          if(nilai % b==0)
}
}

int kpk::output()
{
    cout<<"KPK Antara "<<a<<" dan "<<b<<" Adalah "<<nilai;
       break;
}

int main()
{

    nilai bilangan;
   bilangan.proses();
   bilangan.output();

getch();
}
0 comments
Email This BlogThis! Share to X Share to Facebook

alpro2

Posted by randiadma at 10:22 PM
#include <iostream.h>

#include <conio.h>



class menjumlahkan

{

public:

int proses();

void keluaran();

private:

int n;

float a,total;

};



int menjumlahkan::proses()

{

cout<<"Program Menjumlahkan Bilangan n";

cout<<"Masukkan  angka n: ";

cin>>n;

total=0;

if(n>0)

{

for(int i=1; i<=n; i++)

{

cout<<"masukkan angka ke-"<<i<<" : ";

cin>>a;

total+=a;

}

}

else

{

cout<<"data tidak valid";

}

return total;

}



void menjumlahkan::keluaran()

{

cout<<endl<<endl<<"jumlah dari "<<n<<" bilangan = "<<total;

}



int main()

{
menjumlahkan x;

x.proses();

x.keluaran();



getch();

}
0 comments
Email This BlogThis! Share to X Share to Facebook

alpro

Posted by randiadma at 10:17 PM
#include <iostream.h>
#include <conio.h>
main() {
     int x, y, i;
     int pangkat = 1;
     cout << "Menghitung hasil perpangkatan\n";
     cout << "Tulis bilangan : ";  cin >> x;
     cout << "ingin dipangkat berapa  : ";  cin >> y;
     for (i = 1; i<=y; i++)
            pangkat *= x;
     cout << x << " pangkat “ << y << “ = “  << pangkat;
     getch();
     return 0;
}
0 comments
Email This BlogThis! Share to X Share to Facebook

c++ part 2

Posted by randiadma at 9:54 AM
#include<iostream.h>
#include<conio>
#include<string.h>

char namamu [50], namecpy [50];
void main () {
int posisi;
cout <<"tuliskan nama anda:";
cin>> namamu ;

strcpy (namecpy , namamu );
cout <<namamu <<endl << namecpy <<endl;

if(strcmp (namamu, "slamet")){
cout << "maaf... namamu ganti,to...";
}
else
{cout <<"benar to namamu slamet...";
}

 posisi*strcspn(namamu, "a");
cout<<posisi;
cout<<endl<<strupr(namamu);


getch ();

}
0 comments
Email This BlogThis! Share to X Share to Facebook

c++ part 2

Posted by randiadma at 9:52 AM
#include<iostream.h>
#include<conio.h>

void bola (int r)
{

cout<<"volume bola: "<<4/3*3.14*r*r*r;
cout<<endl;
}

void kubus (int s)
{

cout<<"volume kubus: "<<s*s;
cout<<endl;
}


void balok (int p,int l,int t)
    {

      cout<<" volume balok: "<<p*l*t;
      cout<<endl;
   }

int main () {

  float r,Pi=3.14;
  cout<<" masukkan jari-jari : ";
      cin>>r;

  bola (r);

  int s;
   cout<<"masukkan sisi: ";
      cin>>s;

  kubus (s);


     int p,l,t;
        cout<<"masukkan lebar: ";
      cin>>l;
      cout<<"masukkan tinggi: ";
      cin>>t;
      cout<<"masukkan panjang: ";
      cin>>p;


  balok (p,l,t);


  return 0;
  }
0 comments
Email This BlogThis! Share to X Share to Facebook

Saturday, April 9, 2011

c++

Posted by randiadma at 1:28 PM

#include<iostream.h>
#include<conio>
void main ()
{
 char nama,alamat,nim,ttl;
 cout<<"nama : Randiadma Misbahul Huda";
 cout<<"\n";
 cout<<"alamat : Karang Kalasan,Tirtomartani,Kalasan,Sleman,Yogyakarta";
 cout<<"\n";
 cout<<"NIM : 10018140";
 cout<<"\n";
 cout<<"TTl : Bantul, 24 September 1992";

 getch();
}




0 comments
Email This BlogThis! Share to X Share to Facebook

c++

Posted by randiadma at 1:26 PM
#include<iostream.h>
#include<conio.h>

void segitiga ()
{  cout<<"luas segitiga"<<endl;
    int alas,tinggi  ;
   cout<<"masukan nilai a:";
   cin>>alas;
   cout<<"masukan nilai t:";
   cin>>tinggi;
    cout<<"luasnya adl  "<< 0.5*alas*tinggi<<endl;
}

void persegi()
{  cout<<"luas Persegi"<<endl;
  int sisi1,sisi2;
  cout<<"masukan nilai a:";
   cin>>sisi1;
  cout<<"masukan nilai s:";
   cin>>sisi2;
  cout<<"luasnya adl"<<sisi1*sisi2<<endl;
}
 void lingkaran()
{  cout<<"luas Lingkaran"<<endl;
 int jarijari;
 cout<<"masukan nilai a:";
   cin>>jarijari;

 cout<<"luasnya adl"<<3.14*jarijari*jarijari<<endl;
 }

int main()
{
   segitiga();
   persegi();
   lingkaran();


   getch ();
    return 0;
}
0 comments
Email This BlogThis! Share to X Share to Facebook

c++

Posted by randiadma at 1:25 PM
#pragma argsused
#include <iostream.h>

  class HITUNG {
   private:
    int r, nilai, nilai1;
    double hasil, hasil1;
   public:
     void luas_lingkaran(){
        cout<<"masukkan bilangan r :";
        cin>>r;
        cout<<"phi = 3.14"<<endl;
        hasil = 3.14 * r * r;
        cout<<"hasil luas lingkaran adalah :"<<hasil<<endl;
        cout<<"\n";
        nilai = 4;
        nilai1 = 3;
        hasil1 = (nilai * 3.14 * r * r * r)/nilai1;
        cout<<"hasil volume bola adalah :"<<hasil1<<endl;
     }
     };
int main(){
     int x;
      HITUNG H;
      H.luas_lingkaran();
     cin>>x;

        return 0;
}
0 comments
Email This BlogThis! Share to X Share to Facebook

Sunday, April 3, 2011

part 1

Posted by randiadma at 10:06 AM
 #include <iostream.h>
#include <conio.h>

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();
}

jeliot


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");
        }

}
}
0 comments
Email This BlogThis! Share to X Share to Facebook

Friday, April 1, 2011

jeliot 2

Posted by randiadma at 7:02 AM
public class array {
public static void main(String[]args)
{
   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[i]);
      System.out.print("\n");
   }

}
}
0 comments
Email This BlogThis! Share to X Share to Facebook

jeliot

Posted by randiadma at 7:00 AM
class TitikTengah {
    static void main() {
        Output.println("Masukan nilai x1 : ");
        int x1 = Input.readInt();
        Output.println("Masukan nilai y1 : ");
        int x2 = Input.readInt();
        Output.println("Masukan nilai x2 : ");
        int y1 = Input.readInt();
        Output.println("Masukan nilai y2 : ");
        int y2 = Input.readInt();
        int A,B;
       
        A=(x1+x2)/2;
        B=(y1+y2)/2;

        Output.println("Tampilkan A :" + A);
        Output.println("Tampilkan B :" + B);
    }
}
0 comments
Email This BlogThis! Share to X Share to Facebook
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Sponsored

  • banners
  • banners
  • banners
  • banners

Blog Archive

  • ►  2012 (61)
    • ►  June (2)
    • ►  May (9)
    • ►  April (19)
    • ►  March (27)
    • ►  February (1)
    • ►  January (3)
  • ▼  2011 (44)
    • ►  December (2)
    • ►  November (11)
    • ►  October (1)
    • ►  September (5)
    • ►  May (1)
    • ▼  April (16)
      • bilangan 3 dan 5
      • deret
      • rekursif
      • BBM
      • tugas deret suku
      • alpro3
      • alpro2
      • alpro
      • c++ part 2
      • c++ part 2
      • c++
      • c++
      • c++
      • part 1
      • jeliot 2
      • jeliot
    • ►  March (8)

Followers

Clock Widgets

About Me

My photo
randiadma
Saya Mahasiswa UAD, Jurusan Teknik Informatika,
View my complete profile

My Fuckkn Facebook

Randy Mix Emax

Buat Lencana Anda

Followers

Powered by Blogger.

Blog Archive

  • ►  2012 (61)
    • ►  June (2)
    • ►  May (9)
    • ►  April (19)
    • ►  March (27)
    • ►  February (1)
    • ►  January (3)
  • ▼  2011 (44)
    • ►  December (2)
    • ►  November (11)
    • ►  October (1)
    • ►  September (5)
    • ►  May (1)
    • ▼  April (16)
      • bilangan 3 dan 5
      • deret
      • rekursif
      • BBM
      • tugas deret suku
      • alpro3
      • alpro2
      • alpro
      • c++ part 2
      • c++ part 2
      • c++
      • c++
      • c++
      • part 1
      • jeliot 2
      • jeliot
    • ►  March (8)
 

© 2010 My Web Blog
designed by DT Website Templates | Bloggerized by Agus Ramadhani | Zoomtemplate.com