Kali ini saya akan memberikan contoh scrip Data Jabatan pada Borland C++ di dalam program menggunakan If Else
Silahkan Salin Scrip yang di bawah untuk di Pelajari.
#include "conio.h"
#include "iostream.h"
#include "stdio.h"
main()
{
char gol,jab[10];
long gapok=0;
clrscr( );
cout<<endl<<" Data Jabatan"<<endl
<<" = = = = = = = = = = = = = = = ="<<endl;
cout<<" Masukan Golongan [1/2]: ";
cin>>gol;
if(gol=='1')
{ strcpy(jab,"Direktur");
gapok=5000000;
}
else if(gol=='2')
{
strcpy(jab,"Manajer");
gapok=4000000;
}
else
{
strcpy(jab,"Tidak diketahui");
gapok=0;
}
cout<<" Jabatan = "<<jab<<endl;
cout<<" Gaji Pokok = "<<gapok<<endl;
getch ( );
}
#include "iostream.h"
#include "stdio.h"
main()
{
char gol,jab[10];
long gapok=0;
clrscr( );
cout<<endl<<" Data Jabatan"<<endl
<<" = = = = = = = = = = = = = = = ="<<endl;
cout<<" Masukan Golongan [1/2]: ";
cin>>gol;
if(gol=='1')
{ strcpy(jab,"Direktur");
gapok=5000000;
}
else if(gol=='2')
{
strcpy(jab,"Manajer");
gapok=4000000;
}
else
{
strcpy(jab,"Tidak diketahui");
gapok=0;
}
cout<<" Jabatan = "<<jab<<endl;
cout<<" Gaji Pokok = "<<gapok<<endl;
getch ( );
}
0 komentar:
Posting Komentar