CONTOH CODING MENGGUNAKAN
BORLAND C++
CONTOH APLIKASI PENGGAJIAN
PNS DALAM PILIHANAN GAJIAN MENURUT GRADE
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct jabatan
{
char kode_jabatan;
char nama_jabatan;
int tunjangan;
};
struct pegawai
{
char nip[10];
char nama[30];
char gol[15];
struct jabatan jb;
};
struct pegawai peg;
main()
{
int gaji;
cout<<"\n INPUT DATA\n\n";
cout<<"nip =";gets(peg.nip);
cout<<"Nama=";gets(peg.nama);
cout<<"golongan=";gets(peg.gol);
cout<<"kode
jabatan=";cin>>peg.jb.kode_jabatan;
cout<<"nama
jabatan=";cin>>peg.jb.nama_jabatan;
cout<<"tunjangan=";cin>>peg.jb.tunjangan;
cout<<"\n-----------------------\n\n";
cout<<"\n OUTPUT\n\n";
cout<<"NIP="<<peg.nip<<endl;
cout<<"nama="<<peg.nama<<endl;
cout<<"golongan="<<peg.gol<<endl;
cout<<"kode
jabatan="<<peg.jb.kode_jabatan<<endl;
cout<<"nama
jabatan="<<peg.jb.nama_jabatan<<endl;
cout<<"tunjangan="<<peg.jb.tunjangan<<endl;
if(strcmp(peg.gol,"1a")==0)
gaji=1000000;
else
if(strcmp(peg.gol,"1b")==0)
gaji=2000000;
else
if(strcmp(peg.gol,"1c")==0)
gaji=3000000;
cout<<"gaji pokok="<<gaji<<endl;
getch();
}
No comments:
Post a Comment