Menghitung Gaji dengan C++

Tuesday, March 29, 2011 7:55 AM by Computer and Programming
#include <iostream.h>
#include <conio.h>

void hitung_gapok(int gol)
          {int gapok;
           gapok=gol*1000000;
           cout<<" Gaji pokok               = Rp."<<gapok<<"\n";
           return;}
void hitung_tunjangan (int status)
          {int tunj;
          {if (status==1)
           tunj=0;
          else if(status==2)
           tunj=1000000;}
           cout<<" Tunjangan Kerja          = Rp."<<tunj<<"\n";


          return;}
void hitung_tunak (int anak)
           {int tunak;
            tunak=anak*100000;
            cout<<" Tunjangan Anak           = Rp."<<tunak<<"\n"<<endl;
            return;}
void hitung_pajak (int gol)
           {int pajak;
           pajak=(gol*1000000*0.5/100);
           cout<<" Pajak PBB 0.5%           =(Rp."<<pajak<<")"<<"\n";
           return;}
void hitung_asuransi (int gol)
           {int asuransi;
           asuransi=(gol*1000000*2.5/100);
           cout<<" Asuransi Jiwa 2,5%       =(Rp."<<asuransi<<")"<<"\n";
           return;}
void hitung_gaber (int gol,int tunj,int status,int anak)
          {int gaber;
           {if (status==1)
           tunj=0;
          else if(status==2)
           tunj=1000000;}
           gaber=(gol*1000000)+(tunj)+(anak*100000)-(gol*1000000*3/100);
           cout<<" Gaji Bersih Anda         = Rp."<<gaber;
          return;}


main()
{
char nama [255],gender [255],alamat[255];
int gapok,tunj,status,gaber,gol,awal,jawab,anak;
 awal:
 cout<<"           PT. MAJU MUNDUR           |"<<endl;
 cout<<"             STRUK GAJI              |"<<endl;
 cout<<"======================================"<<endl<<endl;
 cout<<" Nama           : ";cin>>nama;
 cout<<" Gender         : ";cin>>gender;
 cout<<" Alamat         : ";cin>>alamat;
 cout<<" \n ( 1.nikah , 2.belum nikah )"<<endl;
 cout<<" \n Status         : ";cin>>status;
 cout<<" Banyaknya Anak : ";cin>>anak;
 cout<<" golongan       : ";cin>>gol;
 if (gol>=5)
 {clrscr ();
 goto awal;}
 cout<<"\n\n======================================"<<endl<<endl;
 hitung_gapok   (gol);
 hitung_tunjangan (status);
 hitung_tunak (anak);
 cout<<" Potongan :"<<endl<<endl;
 hitung_pajak (gol);
 hitung_asuransi (gol);
 cout<<"======================================"<<endl<<endl;
 hitung_gaber (gol,tunj,status,anak);
 cout<<"\n\n-------------- SELAMAT ---------------";
 getch();
return 0;
}

0 Response to "Menghitung Gaji dengan C++"

Post a Comment