If Else Pada Pemrograman C++

#include <iostream.h>
#include <conio.h>
int main ()
{
char nama[20];
int gol;
float gaji1,tunj1,total1;
float gaji2,tunj2,total2;
float gaji3,tunj3,total3;
cout << “Nama pegawai : “;
cin >> nama;
cout << endl << “Golongan ( 1-3 ) : “;
cin >> gol;
if(gol==1)
{
gaji1=300000;
tunj1=200000;
total1=gaji1+tunj1;
cout<< ” total gaji ” << total1;
}
else if(gol==2)
{
gaji2=600000;
tunj2=250000;
total2=gaji2+tunj2;
cout<< ” total gaji ” << total2;
}
else if(gol==3)
{
gaji3=1500000;
tunj3=300000;
total3=gaji3+tunj3;
cout<< ” total gaji ” << total3;
}
else
cout << endl << “Yang anda masukkan salah!”;
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: