Home
About
Contact
Berbagi ilmu itu indah
Home
Business
Post With Featured Image
Post With Slider
Post with SoundCloud
Post With Video
Technology
Authors
Sitemap
Tags
Timeline
Life & Style
Games
Full Width
Right Sidebar
Left SIdebar
Sports
Stars
Points
Percent
in The Top
Error Page
Breaking News
Monday, April 14, 2014
Contoh program c++ untuk menentukan gaji menggunakan percabagan(if)
#include <conio.h>
#include <iostream.h>
#include <stdio.h>
# define pajak 0.05
main(){
int gaji_pokok, tjg_i, total_gaji, ja, kelamin, status, ta, gaji, pend, jk,st;
cout<<" Pilihan Pendidikan"<<endl;
cout<<" [1] pendidikan d3"<<endl;
cout<<" [2] pendidikan s1"<<endl;
cout<<" [3] pendidikan s2"<<endl;
cout<<"==============================="<<endl;
cout<<" Pilihan gender"<<endl;
cout<<" [1] laki-laki"<<endl;
cout<<" [2] perempuan"<<endl;
cout<<"==============================="<<endl;
cout<<" Pilihan Status"<<endl;
cout<<" [1] menikah"<<endl;
cout<<" [1] belum menikah"<<endl;
cout<<"==============================="<<endl;
cout<<" Masukkan pendidikan karyawan :";cin>>pend;
switch(pend){
case 1:
gaji_pokok = 500000;
break;
case 2:
gaji_pokok = 750000;
break;
case 3:
gaji_pokok = 1000000;
break;
default:
gaji_pokok = 0;
}
cout<<" Gaji pokok anda : "<<gaji_pokok<<endl;
cout<<"==============================="<<endl;
cout<<" Masukkan jk karyawan : ";cin>>jk;
cout<<" Masukkan status : ";cin>>st;
switch (jk) {
case 1:
kelamin = 1;
break;
case 2:
kelamin = 2;
break;
default:
kelamin = 3;
}
switch (st) {
case 1:
status = 1;
break;
case 2:
status = 2;
break;
default:
status = 3;
}
if ((kelamin == 1) && (status == 1) )
{ cout<<" Masukkan jumlah anak :" ;cin>>ja;
if (ja == 1)
{tjg_i = 500000;
ta = 200000; }
else
{
tjg_i = 500000;
ta = 400000; }
}
else
{
tjg_i = 0;
ta = 0;
}
gaji = gaji_pokok + tjg_i + ta;
cout<<" Anda mendapat tunjangan istri sebesar : "<<tjg_i<<endl;
cout<<" Anda mendapat tunjangan Anak sebesar : "<<ta<<endl;
cout<<"==============================="<<endl;
cout<<" Gaji anda : "<< gaji<<endl;
cout<<" Pajak 5% dari tolal gaji"<<endl;
total_gaji = (gaji_pokok + tjg_i + ta)-((gaji_pokok + tjg_i + ta)*pajak) ;
cout<<" Maka gaji bersih anda(setelah dipotong pajak) : "<<total_gaji;
getch(); }
hasil program akan tampak seperti berikut:
semoga bermanfaat..
Share !
Tweet
Designed By