D4n9k3l's Blog
Just another WordPress.com weblog

If

Listing Program If :

#include<conio.h>
#include<stdio.h>
#include<iostream.h>
main()
{
char kode[8],nama[15],alamat[50],golongan,nama_golongan[50],izy;
long int tarif,pemakaian,total,bayar,kembalian;
d4n9k3l:
clrscr();
cout<<“\t  PERHITUNGAN TARIF LISTRIK”<<endl;
cout<<“———————————————“<<endl;
cout<<“Input Kode Pelanggan      : “;cin>>kode;
cout<<“Input Nama Pelanggan      : “;gets(nama);
cout<<“Input Alamat Pelanggan    : “;gets(alamat);
cout<<“Input Kode Golongan[1/2/3]: “;cin>>golongan;
cout<<“Input Jumlah Pemakaian    : “;cin>>pemakaian;
if (golongan==’1′)
{
strcpy(nama_golongan,”Rumah Tangga”);
tarif=100;
}
else if (golongan==’2′)
{
strcpy(nama_golongan,”Sosial”);
tarif=150;
}
else if(golongan==’3′)
{
strcpy(nama_golongan,”Industri”);
tarif=200;
}
else
{
strcpy(nama_golongan,”Anda Salah Memasukan Kode Golongan”);
tarif=0;
}
total=tarif*pemakaian;
clrscr();
cout<<“\t  PERHITUNGAN TARIF LISTRIK”<<endl;
cout<<“———————————————“<<endl;
cout<<“Kode Pelanggan      : “<<kode<<endl;
cout<<“Nama Pelanggan      : “<<nama<<endl;
cout<<“Alamat Pelanggan    : “<<alamat<<endl;
cout<<“Kode Golongan[1/2/3]: “<<golongan<<endl;
cout<<“Nama Golongan       : “<<nama_golongan<<endl;
cout<<“Tarif               : “<<tarif<<endl;
cout<<“Jumlah Pemakaian    : “<<pemakaian<<endl;
cout<<“Total Bayar         : Rp. “<<total<<endl;
cout<<“———————————————“<<endl;
cout<<“Bayar     : Rp. “;cin>>bayar;
kembalian=bayar-total;
cout<<“Kembalian : Rp. “<<kembalian<<endl;
cout<<endl;
cout<<“Ingin Input Lagi [Y/T]: “;cin>>izy;
if (izy==’Y’||izy==’y’)
goto d4n9k3l;
getch();
}

Belum Ada Tanggapan to “If”

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: