3 November 2010

TUGAS ORKOM

1.       Jelaskan perbedaan utama organisasi computer dan arsitektur computer ? beri contohnya !
Jawab :
Ø Arsitektur berkaitan dengan Atribut-atribut yang tampak bagi programmer.
Contoh : Set Instruksi, jumlah bit yang digunakan untuk penyajian data, mekanisme
I/O, teknik pengalamatan.
Ø Organisasi komputer berkaitan dengan unit-unit operasional dan interkoneksinya yang merealisasikan spesifikasi arsitektural
Contoh : teknologi hardware, perangkat antarmuka, teknologi memori, sistem memori, dan sinyal–sinyal control.
Ø Arsitektur sama, organisasi dapat berbeda.
Ø Arsitektur bertahan lama, organisasi menyesuaikan perkembangan teknologi.
·       Semua intel family x86 memiliki arsitektur dasar yang sama.
·       Family IBM system/ 370 memiliki arsitektur dasar yang sama.
·       Memberikan compabilitas instruksi level mesin.
·       Organisasi antar versi memiliki perbedaan

2 November 2010

struktur data praktikum 5

#include <iostream>
#ifndef __xcept
#define __xcept
// exception classes for various error types
 // bad initializers
class BadInitializers {
public:
       BadInitializers() {}
 };
 // insufficient memory
class NoMem {
public:
       NoMem() {}
};
// change new to throw NoMem instead of xalloc
void my_new_handler()
{
throw NoMem();
};
//new_handler Old_Handler_ = set_new_handler(my_new_handler);
// improper array, find, insert, or delete index
// or deletion from empty structure
class OutOfBounds {
public:
OutOfBounds() {}
};
// use when operands should have matching size
class SizeMismatch {
public:
       SizeMismatch() {}
};
// use when zero was expected
class MustBeZero {
public:
       MustBeZero() {}
};
// use when zero was expected
class BadInput {
public:
       BadInput() {}
};
#endif

//CLASS ARRAY1D:
using namespace std;          
class Array1D{
      friend ostream& operator<<(ostream&, const Array1D&);
public:
       Array1D(int size=0);
       Array1D(const Array1D& v);
       ~Array1D(){delete [] element;}
       int& operator[](int i)const;
       int Size(){return size;}
       Array1D& operator=(const Array1D& v);
       Array1D operator+()const;
       Array1D operator+(const Array1D& v)const;
       Array1D operator-()const;
       Array1D operator-(const Array1D& v)const;
       Array1D operator*(const Array1D& v)const;
       Array1D& operator+=(const int& x);
       Array1D& Resize(int sz);
       void geser_kiri();
       void geser_kanan();
private:
        int size;
        int* element;
};
Array1D::Array1D(int sz){
                     if(sz<0)throw BadInitializers();
                     size=sz;
                     element=new int[sz];
}
Array1D::Array1D(const Array1D& v){
                       size=v.size;
                       element=new int[size];
                       for(int i=0; i<size; i++)
                       element[i]=element[i];
}
int& Array1D::operator[](int i)const{
     if(i<0||i>=size)throw OutOfBounds();
     return element[i];
}
Array1D& Array1D::operator=(const Array1D& v){ 
         if(this !=&v){
         size=v.size;
         delete[]element;
         element=new int[size];
         for(int i=0;i<size;i++)
         element[i]=element[i];
         }
       return* this;
}
Array1D Array1D::operator+(const Array1D& v)const{
        if (size != v.size) throw SizeMismatch();
        Array1D w(size);
        for(int i=0; i<size; i++)
        w.element[i]=element[i]+v.element[i];
        return w;
}
Array1D Array1D::operator-(const Array1D& v)const{
        if(size != v.size) throw SizeMismatch();
        Array1D w(size);
        for(int i=0; i<size; i++)
        w.element[i]=element[i]-v.element[i];
        return w;
}
Array1D Array1D::operator-()const{
        Array1D w(size);
        for(int i=0; i<size; i++)
        w.element[i]=-element[i];
        return w;
}
Array1D Array1D::operator*(const Array1D& v)const{
        if(size != v.size) throw SizeMismatch();
        Array1D w(size);
        for(int i=0; i<size; i++)
        w.element[i]=element[i]=v.element[i];
        return w;
}
Array1D& Array1D::operator+=(const int& x){
         for(int i=0; i<size;i++)
         element[i]+=x;
         return* this;
}
ostream& operator<<(ostream& out, const Array1D& x){
         for(int i=0; i<x.size; i++)
         out << x.element[i] << " ";
         return out;
}
Array1D& Array1D::Resize(int sz){
         if(sz<0) throw BadInitializers();
         delete[]element;
         size=sz;
         element=new int[size];
         return* this;
}

 //FUNGSI MAINNYA:
int main(int argc, char *argv[])
{
         try{
         Array1D X(10), Y, Z;
         for(int i=0; i<10; i++)
            X[i]=i;
         cout << "X[3] = " << X[3] << endl;
         cout << "\nX is \n" << X << endl;
            Y=X;
         cout << "\nY is \n" << Y << endl;
            X += 2;
         cout << "\nX increment by 2 is \n" << X << endl;
            Z=(Y+X)*Y;
         cout << "\n(Y+X)*Y is \n" << Z << endl;
         cout << "\n-(Y+X)*Y is \n" << -Z << endl;
}
         catch(...){
         cout << "An Exception has occured" << endl;}
         
system("PAUSE");
return EXIT_SUCCESS;
}

22 Oktober 2010

Struktur data praktikum 4

#include <cstdlib>
#include <iostream>
#define maks 5

using namespace std;

class array1d{

  friend ostream& operator<<(ostream&, const array1d&);
friend istream& operator>>(istream&, array1d&);

public:

  array1d();
  void cetak();
  void geser_kiri();
  void geser_kanan();
  void hapus();
private:

char a[maks];

};



array1d::array1d(){

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

a[i]='0';

}



void array1d::cetak(){

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

cout<<a[i]<<"";

}



ostream& operator<<(ostream& out, const array1d& x){

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

cout<<x.a[i]<<"";

cout<<endl;

return out;

}



istream& operator>>(istream& in, array1d& x){

int posisi;

cout<<"Mengisi array pada posisi ke: ";

in>>posisi;

if(posisi>0&&posisi<=maks){

cout<<"Masukkan elemen array nya: ";

in>>x.a[posisi-1];

}

else

cout<<"Anda memasukkan posisi di luar range...\n";

return in;

}



void array1d::geser_kanan(){

int n=maks;

int temp=a[n-1];

for(int i=n-1;i>=0;i--)

a[i+1]=a[i];

a[0]=temp;

}



void array1d::geser_kiri(){

int n=maks;

int temp=a[0];

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

a[i]=a[i+1];

a[n-1]=temp;

}

void array1d::hapus(){

int pil;

cout<<"Elemen yang akan di hapus: ";

cin>>pil;

int n=maks;

for(int i=pil-1;i<n;i++){

a[i]=a[i+1];

}

a[n-1]='0';

}


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

{

array1d x;
cout<<"Nama : Anis Nurwanto\n\n";

cout<<"Array masih kosong: "<<x;

cin>>x;

cout<<"Isi Array saat ini: "<<x;

x.geser_kiri();

cout<<"Isi Array setelah digeser kiri: "<<x;

x.geser_kanan();

cout<<"Isi Array setelah digeser kanan: "<<x;

x.hapus();

cout<<"Isi Array setelah dihapus: "<<x;

system("PAUSE");

return EXIT_SUCCESS;

}

13 Oktober 2010

struktur data praktikum 3

Pertama tak beri File Indukannya

#ifndef __bilangan
#define __bilangan
#include <iostream.h>

class Bilangan {
       friend ostream& operator<<(ostream&, const Bilangan&);
       friend istream& operator>>(istream&, const Bilangan&);

       public:
              Bilangan(int a0=0,float b0=0.0):a(a0),b(b0){}
              void banding_int(const Bilangan&, const Bilangan&);
              Bilangan& operator=(const Bilangan&);
              Bilangan operator+(const Bilangan&)const;
              Bilangan& operator-()const;

       //protected:
              int a;
              float b;
};

ostream& operator<<(ostream& out, const Bilangan& x)
{
 out<<"Bagian Integer : "<<x.a<<endl;
 out<<"Bagian float : "<<x.b<<endl;
 return out;
}

void Bilangan::banding_int(const Bilangan& x,const Bilangan& y)
{
 if(x.a>y.a) cout<<x.a<<"::x lebih besar dari "<<y.a<<":: y";
 else cout<<x.a<<"::x lebih kecil dari "<<y.a<<":: y";
}

Bilangan& Bilangan::operator=(const Bilangan& x)
{
 a=x.a;
 b=x.b;
 return *this;
}

istream& operator>>(istream& in, Bilangan& x)
{
 cout<<"\nMasukkan bagian Integer : ";
 in>>x.a;
 cout<<"\nMasukkan bagian float   : ";
 in>>x.b;
 return in;
}

Bilangan Bilangan::operator+(const Bilangan& x) const
{
 Bilangan cc;
 cc.a=a+x.a;
 cc.b=b+x.b;
 return cc;
}

Bilangan& Bilangan::operator-() const
{
 Bilangan x;
 x.a=-a;
 x.b=-b;
 return x;
}
#endif

Simpan file diatas dengan nama “bilangan.h”
Kedua kita buat anakannya “bilchar.h”
#ifndef __bilchar
#define __bilchar
#include <iostream.h>
#include “Bilangan.h”
using namespace std;

class Bil_Char:public Bilangan
{
friend ostream& operator<<(ostream&, const Bil_Char&);
friend istream& operator>>(istream&,Bil_Char&);
public:
Bil_Char(int a0=0, int b0=0, char ch=’x'):Bilangan(a0,b0),c(ch){}
void banding_Float(const Bil_Char&, const Bil_Char&);
private:
float c;
};

ostream& operator<<(ostream& out, const Bil_Char& x)
{
out<<”Bagian integer : “<<x.a<<endl;
out<<”Bagian float   : “<<x.b<<endl;
out<<”Bagian char    : “<<x.c<<endl;
return out;
}

istream& operator>>(istream& in,Bil_Char& x)
{
cout<<”\nMasukkan bagian Integer : “;
in>>x.a;
cout<<”\nMasukkan bagian float   : “;
in>>x.b;
return in;
}

void Bil_Float::banding_Char(const Bil_Float& x,const Bil_Float& y)
{
if(x.a>y.a) cout<<x.a<<”::x lebih besar dari “<<y.a<<”:: y”;
else cout<<x.a<<”::x lebih kecil dari “<<y.a<<”:: y”;
}
#endif


Simpan dengan nama “bilchar.h”
Ketiga buat “bilfloat.h”

#ifndef __bilfloat
#define __bilfloat
#include <iostream.h>
#include "bilangan.h"
using namespace std;

class Bil_Float:public Bilangan
{
      friend ostream& operator<<(ostream&, const Bil_Float&);
      friend istream& operator>>(istream&,Bil_Float&);
      public:
             Bil_Float(int a0=0, int b0=0, char ch='x'):Bilangan(a0,b0),c(ch){}
             void banding_Float(const Bil_Float&, const Bil_Float&);
      private:
              float c;
};

ostream& operator<<(ostream& out, const Bil_Float& x)
{
         out<<"Bagian integer : "<<x.a<<endl;
         out<<"Bagian float   : "<<x.b<<endl;
         out<<"Bagian char    : "<<x.c<<endl;
         return out;
}

istream& operator>>(istream& in,Bil_Float& x)
{
         cout<<"\nMasukkan bagian Integer : ";
         in>>x.a;
         cout<<"\nMasukkan bagian float   : ";
         in>>x.b;
         return in;
}

void Bil_Float::banding_Float(const Bil_Float& x,const Bil_Float& y)
{
     if(x.a>y.a) cout<<x.a<<"::x lebih besar dari "<<y.a<<":: y";
     else cout<<x.a<<"::x lebih kecil dari "<<y.a<<":: y";
}
#endif

Terakhir untuk menampilkan program tersebut

#include <cstdlib>
#include <iostream>
#include "bilfloat.h"
using namespace std;
int main(){
    Bilangan s,t(-2,3.14),d;
    cout<<"Nilai awal s\n"<<s;
    cout<<"Nilai awal t dari deklarasi\n"<<t;
    s=t;
    cout<<"Setelah di-assign t\n";
    cout<<"Nilai s\n"<<s;
    cout<<"Masukkan nilai-nalai objek d";
    cin>>d;
    cout<<"setelah d + t => \n"<<d+t;
    cout<<"Nalai d dinegatifkan\n"<<-d;
    Bil_Float ss;
    cout<<"Nilai awal ss\n"<<ss;
    system("PAUSE");
    return EXIT_SUCCESS;
}

11 Oktober 2010

Setting GPRS, MMS

>for operator INDOSAT
Menu
 > Setting > Network settings > Connections > Create >

name : ISAT WAP
access name : indosatgprs
auth type : normal
user id : indosat
password : indosat
protocol : http
home url : http://wap.indosat.com
proxy address : 10.19.19.19:8080
linger time : 90 > save

Menu > Setting > Network settings > Connections > Create >
name : ISAT MMS
access name : indosatmms
auth type : normal
user id : indosat
password : indosat
protocol : http
home url : http://mmsc.indosat.com
proxy address : 10.19.19.19:8080
linger time : 90 > save

>for operator XL
name : XL WAP
access name : www.xlgprs.net
auth type : normal
user id : xlgprs
password : proxl
protocol : http
home url : http://wap.xl.co.id
proxy address : 202.152.240.50:8080
linger time : 90 > save

Menu > Setting > Network settings > Connections > Create >
name : XL MMS
access name : www.xlmms.net
auth type : normal
user id : xlgprs
password : proxl
protocol : http
home url : http://mmc.xl.net.id/servlets/mms
proxy address : 202.152.240.50:8080
linger time : 90 > save

> for operator TELKOMSEL
Menu > Setting > Network settings > Connections > Create >
name : TSEL WAP
access name : telkomsel
auth type : normal
user id : wap
password : wap123
protocol : http
home url : http://wap.telkomsel.com
proxy address : 10.1.89.130:8000
linger time : 90 > save

Menu > Setting > Network settings > Connections > Create >
name : TSEL MMS
access name : mms
auth type : normal
user id : wap
password : wap123
protocol : http
home url : http://mms.telkomsel.com
proxy address : 10.1.89.150:8000
linger time : 90 > save

>for operator 3 (THREE)
Menu > Setting > Network settings > Connections > Create >
name : 3 WAP
access name : 3gprs
auth type : normal
user id : 3gprs
password : 3gprs
protocol : http
home url : http://wap.three.co.id/
proxy address : 10.4.0.10:3128
linger time : 90 > save

Menu > Setting > Network settings > Connections > Create >
name : 3 MMS
access name : 3mms
auth type : normal
user id : 3mms
password : 3mms
protocol : http
home url : http://mms.hutch.co.id/
proxy address : 10.4.0.10:3128
linger time : 90 > save

>for operator AXIS
Menu > Setting > Network settings > Connections > Create >
name : AXIS WAP
access name : AXIS
auth type : normal
user id : AXIS
password : 123456
protocol : http
home url : http://wap.axisworld.co.id/
proxy address : 10.8.3.8:8080
linger time : 90 > save

Menu > Setting > Network settings > Connections > Create >
name : AXIS MMS
access name : AXISmms
auth type : normal
user id : AXIS
password : 123456
protocol : http
home url : http://mmsc.AXIS
proxy address : 10.8.3.8:8080
linger time : 90 > save

>for operator IM2
Menu > Setting > Network settings > Connections > Create >
name : IM2
access name : indosatm2
auth type : normal
user id : xxxxx
password : xxxxx
protocol : http
home url :
proxy address :
linger time : 90 > save

SAMSUNG

Factory Code STAR
Some basic Factory Code for Samsung :

Admin Setting : *#6984125*#
No. 2. Pre-configuration - Operator Code : *#73561*#
No. 4. Internals - Master Code : *#9072641*# (Use at your own risk, don't simply change)

Check IMEI : *#06#

Check SW Version : *#1234#

Check FTA SW Version : *#1111#

Check FTA HW Version : *#2222#

Check SW|Tune|HW-Version, RF Cal Date & D/L Date : *#0206*8376263#

Check Battery Status : *#0228#

Check Bluetooth Device Address : *#232337# (Need to power off once access this)

Test Mode : *#0*#

HSDPA|3G|EDGE|GPRS Power On Attach : *#4777*8665#

Factory / Hard Reset : *2767*3855# (All data & setting in phone erase & reset to factory default automatically without warning)

This code has something to do with phone locking : *#7465625#

This code *#0002*28346# has
[1] Debug Screen
[2] Version Information
[3] RF test
[4] UMTS rf nv
[5] Read gsm rf nv
[6] Write gsm rf nv
[7] Base Band
[8] Audio
[9] Common


Menyembunyikan ikon EDGE(E)/GPRS(G)
agi yang mengalami masalah / keluhan dengan lambang "EDGE" yang selalu muncul ketika selesai upgrade firmware ke versi [S5230XEIG2], bisa mengikuti tip's berikut ini untuk mengatasinya..
[quote]
- Buka keypad & ketik di keypad : *#4777*8665#
- Hilangkan tanda 'contreng' pada pilihan "Power On Attach"..
- Restart HP Anda & tanda (E) "EDGE" Icon akan hilang..

NB : Apabila Anda mengikuti cara ini, maka tanda (E) "EDGE" Icon hanya akan muncul pada waktu Anda memerlukannya.. [/QUOTE




10 Oktober 2010

struktur data praktikum 2

#include <cstdlib>
#include <iostream>

using namespace std;
template<class T>
class Kompleks{
      friend class Operasi<T>;
      friend ostream& operator<<(ostream&,const Kompleks<T>&);
      friend istream& operator>>(istream&, Kompleks<T>&);
    
public:
       Kompleks(T s=0,T t=0):a(s),b(t){}
       void cetak();
       Kompleks operator-();
       Kompleks operator-(const Kompleks<T>&);
       Kompleks operator+(const Kompleks<T>&);
        Kompleks operator*(const Kompleks<T>&);
      
       private:
T a;
T b;
       };
    
template <class T> Kompleks<T> Kompleks<T>::operator-(const Kompleks<T>& m){
           Kompleks x;
           x.a=a-m.a;
           x.b=b-m.b;
           return x;
            }
template <class T> Kompleks<T> Kompleks<T>::operator+(const Kompleks<T>& m){
         Kompleks x;
         x.a=a+m.a;
         x.b=b+m.b;
         return x;
         }
template <class T> Kompleks<T> Kompleks<T>::operator*(const Kompleks<T>& m){
         Kompleks x;
         x.a=a*m.a;
         x.b=b*m.b;
         return x;
         }
template<class T> ostream& operator<<(ostream& out, const Kompleks<T>& x){
           if(x.b==0)out<<'['<<x.a<<']';
           else if(x.a==0 && x.b==1)out<<'['<<"i"<<']';
           else if(x.a==0 && x.b==-1)out<<'['<<"-i"<<']';
           else if(x.a==0 && x.b>1)out<<'['<<x.b<<"i"<<']';
           else if(x.a==0 && x.b<-1)out<<'['<<x.b<<"i"<<']';
           else if(x.b==1)out<<'['<<x.a<<"+"<<"i"<<']';
           else if(x.b>0)out<<'['<<x.a<<"+"<<x.b<<"i"<<']';
           else if(x.b==-1)out<<'['<<x.a<<"-i"<<']';
           else out<<'['<<x.a<<x.b<<"i"<<']';
           return out;
               }
template<class T> istream& operator>>(istream& in,Kompleks<T>& x){
         cout<<"masukkan bagian real:";
         in>>x.a;
         cout<<"masukkan bagian imajiner:";
         in>>x.b;
         return in;
                  }
template<class T>
class Operasi{
      public:
             Kompleks<T> jumlah (const Kompleks<T>&,const Kompleks<T>&);
             Kompleks<T> kali(const Kompleks<T>&, const Kompleks<T>&);
             Kompleks<T> kurang(const Kompleks<T>&, const Kompleks<T>&);
             Kompleks<T> kali(const Kompleks<T>&, const Kompleks<T>&);
      };
template<class T> Kompleks<T> Operasi<T>::jumlah (const Kompleks<T>& m, const Kompleks<T>& n){
               Kompleks<T> temp;
               temp.a=m.a+n.a;
               temp.b=m.b+n.b;
               return temp;
                              }
template<class T> Kompleks<T> Operasi<T>::kurang(const Kompleks<T>& m, const Kompleks<T>& n){
              Kompleks<T> temp;
               temp.a=m.a-n.a;
               temp.b=m.b-n.b;
               return temp;
                }
template<class T> Kompleks<T> Operasi<T>::kali(const Kompleks<T>& m, const Kompleks<T>& n){
               Kompleks<T> temp;
               temp.a=(m.a*n.a)-(m.b*n.b);
               temp.b=(m.b*n.b)-(m.b*n.a);
               return temp;
               }              
                        
int main(int argc, char *argv[])
{
  Kompleks<int> x(2,3),y(4,-4),t;
  Operasi<int> z;
  cout<<"menggunakan cetak():";x.cetak();
  cout<<"Menggunakan overloading :"<<x;
  cout<<"KOnjugat:"<<-x;
  y.cetak();
  cout<<"\npenjumlahan menggunakan methods:";
  t=z.jumlah(x,y);
  t.cetak();
  cout<<"Penjumlahan Menggunakan operator:";
  t=x+y;
  cout<<x<<"+"<<y<<"="<<t;
  cout<<"\nPerkalian menggunakan methods:";
  t=z.kali(x,y);
  t.cetak();
  cout<<"Perkalian menggunakan operator:";
  t=x*y;
  cout<<x<<"*"<<y<<"="<<t;
  t=x-y;
  cout<<"\n"<<x<<"-"<<y<<"="<<t<<endl;
  Kompleks<int> n;
  cin>>n;
  cout<<n;
  return 0;
  
    system("PAUSE");
    return EXIT_SUCCESS;
}

23 September 2010

Listing Program C++

"Rumus Perkalian Pembagian Pengurangan penjumlahan"
1) Listing Penjumlahan 2Bilangan Bulat
1
#include <cstdlib>
2
#include <iostream>
3
4
using namespace std;
5
int Jumlah_2Bilangan (int o,int  p){
6
Int Jumlah;
7
Jumlah = o+p;
8
return Jumlah;
9
}
10
11
int main(){
12
13
    cout<< " *** Penjumlahan Dua Bilangan Bulat ***\n\n";
14
   
15
    int o, p, Jumlah;
16
    cout << " Masukkan Bilangan Bulat" <<endl;
17
    cout << " Bilangan Pertama = ";
18
       cin >> o;
19
    cout << " Bilangan Kedua = ";
20
       cin >> p;
21
    Jumlah= Jumlah_2Bilangan(o,p);
22
    cout <<" Hasil penjumlahannya adalah = " << Jumlah << endl;
23
   
24
    system("PAUSE");
25
    return EXIT_SUCCESS;
26
}

2) Listing Pengurangan 2Bilangan Bulat
1
#include <cstdlib>
2
#include <iostream>
3
4
using namespace std;
5
int  Pengurangan_2Bilangan (int o,int  p){
6
int  kurang;
7
kurang = o-p;
8
return  kurang;
9
}
10
11
int  main () {
12
13
    cout<< " ***  Pengurangan Dua Bilangan Bulat  ***\n\n";
14
   
15
    int o, p, kurang;
16
    cout << " Masukkan Bilangan Bulat" <<endl;
17
    cout << " Bilangan Pertama = ";
18
       cin >> o;
19
    cout << " Bilangan Kedua = ";
20
       cin >> p;
21
    kurang= Pengurangan_2Bilangan(o,p);
22
    cout <<" Hasil pengurangannya adalah = " << kurang << endl;
23
   
24
    system("PAUSE");
25
    return EXIT_SUCCESS;
26
}

3) Listing Perkalian 2Bilangan Bulat
1
#include <cstdlib>
2
#include <iostream>
3
4
usin g namespace std;
5
int  Perkalian_2Bilangan (int o,int  p){
6
int  kali;
7
kali = o*p;
8
return  kali;
9
}
10
11
int  main () {
12
13
    cout<< " *** Perkalian Dua Bilangan Bulat ***\n\n";
14
   
15
    int o, p, kali;
16
    cout << " Masukkan Bilangan Bulat" <<endl;
17
    cout << " Bilangan Pertama = ";
18
       cin >> o;
19
    cout << " Bilangan Kedua = ";
20
       cin >> p;
21
    kali= Perkalian_2Bilangan(o, p);
22
    cout <<" Hasil perkaliannya adalah = " << kali << endl;
23
   
24
    system("PAUSE");
25
    return  EXIT_SUCCESS;
26
}

4) Listing Pembagian 2Bilangan Bulat
1
#include  <cstdlib>
2
#include  <iostream>
3
4
using  namespace std;
5
int Pembagian_2Bilangan (int o,int  p){
6
int  bagi;
7
bagi = o/p;
8
return  bagi;
9
}
10
11
int  main () {
12
13
    cout << "  ***  Pembagian Dua Bilangan Bulat  ***\n\n";
14
   
15
    int  o, p, bagi;
16
    cout << " Masukkan Bilangan Bulat "  << endl;
17
    cout << " Bilangan Pertama = ";
18
       cin >> o;
19
    cout << " Bilangan Kedua = ";
20
       cin >> p;
21
    bagi= Pembagian_2Bilangan(o, p);
22
    cout << " Hasil pembagiannya adalah  = "  <<  bagi  <<  endl;
23
   
24
    system("PAUSE");
25
    return  EXIT_SUCCESS;
26
}

5) Listing Pangkat3
1
#include  <cstdlib>
2
#include  <iostream>
3
4
using  namespace std;
5
float  pangkat3 (float u){
6
float  Q;
7
Q = u*u*u;
8
return  Q;
9
}
10
                      
11
int  main () {
12
cout <<  " ***  Menghitung nilai Pangkat 3  ***\n\n";
13
    float  u,  pangkat;
14
    cout <<  "Masukan nilai u :   ";
15
        cin  >>  u;
16
  
17
    pangkat=pangkat3(u);
18
    cout <<  "Hasil setelah dipangkatkan 3 adalah  " << pangkat << endl;
19
     
20
    system("PAUSE");
21
    return  EXIT_SUCCESS;
22
}

6) Listing Fungsi max
1
#include <cstdlib>
2
#include <iostream>
3
4
using  namespace  std;
5
6
int  max(int b,  int c){
7
    if(b < c)
8
     return  c;
9
    Else
10
     return  b;
11
    
12
}
13
14
int  main () {
15
    int m, n;
16
    do  {
17
        cout << "  ***  Fungsi Max  ***\n\n " ;
18
       
19
        cout << " Masukkan dua angka : ";
20
        cin  >>  m  >>  n ;
21
        cout << " max("  << m  <<  ","  <<  n  << ")  = " <<  max(m,n) << endl;
22
       
23
}while (m !=0);
24
     
25
    system("PAUSE");
26
    return  EXIT_SUCCESS;
27
}

7) Listing Fungsi Fact
1
#include  <cstdlib>
2
#include  <iostream>
3
4
using  namespace  std;
5
6
int  fact (int n) {
7
   if(n < 0)
8
     return 0;
9
   else {
10
     int i=1;
11
     while(n>1)
12
       i *=n--;
13
    
14
   return i;
15
   }
16
}
17
18
int  main ()  {
19
   
20
    cout << "  ***  Fungsi Fact  ***\n\n ";
21
   
22
   for(int i = -1; i<6; i++)
23
       cout <<  " "  <<  fact(i);
24
   cout  <<  endl;
25
   
26
   system("PAUSE");
27
   return  EXIT_SUCCESS;
28
}