CPP Menghitung Gaji Pokok dan Tunjangan


Contoh Program CPP Menghitung Gaji Pokok dan Tunjangan


Script :
#include <iostream.h>
#include <conio.h>
#include <math.h>
#include <stdio.h>
#include<string.h>
void main()
{
char nip[10], nama[20],jabatan[10];
 int gol;
 clrscr();
 long gaji_pokok, jml_anak, tabungan, simp_wajib, simp_pokok;
 double total_gaji, total_terima_gaji, potongan, tunj_anak, tunj_istri;
 //double gaji_pokok;
tabungan = 25000;
simp_wajib =20000;
simp_pokok=15000;
cout<<" masukkan nip = "; cin>>nip;
cout<<" masukkan nama = "; gets(nama);
cout<<"masukkan gol = ";cin>>gol;
cout<<"masukkan gapok=";cin>>gaji_pokok;
cout<<" masukkan jml anak = "; cin>>jml_anak;


tunj_istri=(2*gaji_pokok)/100;
tunj_anak= (jml_anak*3*gaji_pokok)/100;
potongan = tabungan + simp_wajib + simp_pokok;
total_gaji = (gaji_pokok+tunj_istri+tunj_anak);
total_terima_gaji = (gaji_pokok+tunj_istri+tunj_anak)-potongan;
if (gol==1)
{cout<<"jabatan=manager";cout<<"\n";}
else if (gol==2)
{cout<<"jabatan=direktur";}
else if (gol==3)
{cout<<"jabatan=staf";}
else if (gol==4)
{cout<<"jabatan=umum";}
cout<<"\n";
//output
cout<<"*********************************************************";
cout<<"\n";
cout<<"   GAJI PEGAWAI BULAN : OKTOBER 2009"; cout<<"\n";
cout<<"*********************************************************"; cout<<"\n";
cout<<"NIP : " <<nip; cout<<"\n";
cout<<"NAMA : " <<nama; cout<<"\n";
cout<<"GOL : " <<gol; cout<<"\n";
cout<<"JABATAN : " <<jabatan;cout<<"\n";
cout<<"GAJI POKOK : "<<gaji_pokok; cout<<"\n";
cout<<"JUMLAH ANAK : "<<jml_anak; cout<<"\n";
cout<<"TUNJANGAN ISTRI : "<<tunj_istri; cout<<"\n";
cout<<"TUNJANGAN ANAK : "<<tunj_anak; cout<<"\n";
cout<<"*********************************************************"; cout<<"\n";
cout<<"TOTAL GAJI : " <<total_gaji; cout<<"\n";
cout<<"*********************************************************"; cout<<"\n";
cout<<"POTONGAN : " <<potongan; cout<<"\n";
cout<<"*********************************************************"; cout<<"\n";
cout<<"TOTAL TERIMA : " <<total_terima_gaji;  cout<<"\n";
cout<<"*********************************************************";
getch();
}


Terimakasih atas komentar Anda.
Budayakan Bertanya dan Berkomentar dengan Sopan.
Tolong tinggalkan komentar jika Anda menemukan Link yang Broken.
EmoticonEmoticon