4.12.11

C++ GAJI HARIAN (FUNGSI)



#include<iostream.h>
#include<conio.h>
int jml,gp,lem,mkn,trans;
char nm[30],nip[8];
void garis();
void pokok();
void lembur();
void makan();
void transport();
void main()
{
cout<<"GAJI HARIAN PT XYZ\n";
garis();
    cout<<"NIP : ";cin>>nip;
    cout<<"Nama : ";cin>>nm;
    cout<<"Jumlah Jam Kerja : "; cin>>jml;
    garis();
    cout<<"NIP : "<<nip;
    cout<<"\n";
    cout<<"Nama : "<<nm;
    cout<<"\n";
pokok();
lembur();
makan();
transport();
garis();
}
    void garis()
    {
    cout<<"--------------------------------"<<endl;
    }
    void pokok()
   

{
    gp=2000*jml;
    cout<<"Gaji Pokok : "<<gp<<endl;
    }
    void lembur()
    {
    if(jml>7)
   lem=1.5*gp;
    cout<<"Lembur : "<<lem<<endl;
    }
    void makan()
    {
    mkn=3500;
    if(jml<=7)
        {
        cout<<"Uang Makan : 0"<<endl;
        }
            else if(jml>7)
            {
            cout<<"Uang Makan : "<<mkn<<endl;
            }
    }
    void transport()
    {
    trans=4000;
    if(jml<=8)
        {
        cout<<"Transport Lembur : 0"<<endl;
        }
            else if(jml>8)
            {
            cout<<"Transport Lembur : "<<trans<<endl;
            }
    }


Blog Advertising

0 komentar:

Posting Komentar