Borland C++ Tipe A


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
garis()
{
cout<<“=================================================”<<endl;
}

struct
{
char nokomp,jenis,*nmlayanan;
int tarif,durasi,total;
}rental[10];

long int tokes=0;

main()
{
int i,j;
clrscr();
garis();
cout<<”      WARNET BINA CYBER”<<endl;
garis();
cout<<“Jumlah Transaksi    :”;cin>>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<<“Transaksi Ke           :”<<i<<endl;
cout<<“No. Komputer           :”;cin>>rental[i].nokomp;
cout<<“Jenis Layanan          :”;cin>>rental[i].jenis;
if(rental[i].jenis==’A’||rental[i].jenis==’a’)
{rental[i].nmlayanan=”Internet”;rental[i].tarif=2500;}
else if(rental[i].jenis==’B’||rental[i].jenis==’b’)
{rental[i].nmlayanan=”Game Online”;rental[i].tarif=3000;}
else if(rental[i].jenis==’C’||rental[i].jenis==’c’)
{rental[i].nmlayanan=”Game Offline”;rental[i].tarif=2000;}
else if(rental[i].jenis==’D’||rental[i].jenis==’d’)
{rental[i].nmlayanan=”Rental Pengetikan”;rental[i].tarif=1500;}
cout<<“Tarif Permenit         :”<<rental[i].tarif<<endl;
cout<<“Durasi Bermain (menit) :”;cin>>rental[i].durasi;
rental[i].total=rental[i].tarif*rental[i].durasi;
tokes=tokes+rental[i].total;
cout<<endl;
}

clrscr();

garis();
cout<<“No. No.    Jenis       Durasi   Tarif       Total”<<endl;
cout<<”    Komp.  Layanan     Bermain  Permenit         “<<endl;
garis();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(7)<<rental[i].nokomp;
cout<<setiosflags(ios::left)<<setw(12)<<rental[i].jenis;
cout<<setiosflags(ios::left)<<setw(9)<<rental[i].durasi;
cout<<setiosflags(ios::left)<<setw(12)<<rental[i].tarif;
cout<<setiosflags(ios::left)<<setw(5)<<rental[i].total<<endl;
}
garis();
cout<<”                      Total Keseluruhan :”<<tokes<<endl;
//cout<<”             Jenis Layanan Paling Banyak:”<< <<endl;
getch();
}

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: