- Home »
- Belajar C++ Program SPBU
Tada......lagi butuh program SPBU dengan bahasa C++ ya... Ini dia program yang dibuat oleh teman saya di jurusan Teknik Infoermatika STT-PLN Jakarta dalam menyelesaikan tugas akhir semester I kemarin. Programnya sederhana kok..cocok buat belajar untuk pemula :) ceck this out :<
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
long int pil;
double bhanbkr,uang;
char kem;
mulai:
clrscr();
{
cout<<"\n * * * * * * "<<endl;
cout<<"\n * * => selamat datang <= * * "<<endl;
cout<<"\n * * * * * * "<<endl;
cout<<"\ntekan sembarang tombol untuk memulai";
getch();
clrscr();
cout<<"=================================="<<endl;
cout<<" || |SPBU Sumber Rejeki| || "<<endl;
cout<<"=================================="<<endl;
cout<<"\n\n\n****************************************"<<endl;
cout<<"* *"<<endl;
cout<<"* 1. premium = Rp.4500/Liter *"<<endl;
cout<<"* 2. solar = Rp.5000/Liter *"<<endl;
cout<<"* 3. pertamax = Rp.9500/Liter *"<<endl;
cout<<"* 4. super = Rp.9500/Liter *"<<endl;
cout<<"* 5. super extra = Rp.10000/Liter *"<<endl;
cout<<"* 6. super sheld = Rp.10600/Liter *"<<endl;
cout<<"* *"<<endl;
cout<<"****************************************\n\n\n"<<endl;
cout<<"\nmasukkan pilihan anda : ";cin>>pil;
clrscr();
if (pil==1)
{
cout<<"\n\n =======================";
cout<<"\n premium = Rp.4500/Liter"<<endl;
cout<<" =======================\n";
cout<<"\nmasukkan jumlah uang = ";cin>>uang;
bhanbkr=uang/4500;
cout<<"\nPremium "<<bhanbkr<<" liter.";
cout<<"\n\nKembali ke menu utama [Y/T] ? ";
cin>>kem;
clrscr();
if (kem == 'y' || kem == 'Y')
goto mulai;
else if (kem == 't' || kem == 'T')
goto tidak;
}
else if (pil==2)
{
cout<<"\n\n =====================";
cout<<"\n solar = Rp.5000/Liter"<<endl;
cout<<" =====================\n";
cout<<"\nmasukkan jumlah uang = ";cin>>uang;
bhanbkr=uang/5000;
cout<<"\nsolar "<<bhanbkr<<" liter.";
cout<<"\n\nKembali ke menu utama [Y/T] ? ";
cin>>kem;
clrscr();
if (kem == 'y' || kem == 'Y')
goto mulai;
else if (kem == 't' || kem == 'T')
goto tidak;
}
else if (pil==3)
{
cout<<"\n\n =======================";
cout<<"\n pertamax= Rp.9500/Liter"<<endl;
cout<<" =======================\n";
cout<<"\nmasukkan jumlah uang = ";cin>>uang;
bhanbkr=uang/9500;
cout<<"\npertamax "<<bhanbkr<<" liter.";
cout<<"\n\nKembali ke menu utama [Y/T] ? ";
cin>>kem;
clrscr();
if (kem == 'y' || kem == 'Y')
goto mulai;
else if (kem == 't' || kem == 'T')
goto tidak;
}
else if (pil==4)
{
cout<<"\n\n =====================";
cout<<"\n super = Rp.9500/Liter"<<endl;
cout<<" =====================\n";
cout<<"\nmasukkan jumlah uang = ";cin>>uang;
bhanbkr=uang/9500;
cout<<"\nsuper "<<bhanbkr<<" liter.";
cout<<"\n\nKembali ke menu utama [Y/T] ? ";
cin>>kem;
clrscr();
if (kem == 'y' || kem == 'Y')
goto mulai;
else if (kem == 't' || kem == 'T')
goto tidak;
}
else if (pil==5)
{
cout<<"\n\n ============================";
cout<<"\n super extra = Rp.10000/Liter"<<endl;
cout<<" ============================\n";
cout<<"\nmasukkan jumlah uang = ";cin>>uang;
bhanbkr=uang/10000;
cout<<"\nsuper extra "<<bhanbkr<<" liter.";
cout<<"\n\nKembali ke menu utama [Y/T] ? ";
cin>>kem;
clrscr();
if (kem == 'y' || kem == 'Y')
goto mulai;
else if (kem == 't' || kem == 'T')
goto tidak;
}
else if (pil==6)
{
cout<<"\n\n ============================";
cout<<"\n super sheld = Rp.10600/Liter"<<endl;
cout<<" ============================\n";
cout<<"\nmasukkan jumlah uang = ";cin>>uang;
bhanbkr=uang/10600;
cout<<"\nsuper sheld "<<bhanbkr<<" liter.";
cout<<"\n\nKembali ke menu utama [Y/T] ? ";
cin>>kem;
clrscr();
if (kem == 'y' || kem == 'Y')
goto mulai;
else if (kem == 't' || kem == 'T')
goto tidak;
}
else
{
cout<<"Pilihan yang anda masukkan tidak ada.";
cout<<"\n\nKembali ke menu utama [Y/T] ? ";
cin>>kem;
clrscr();
if (kem == 'y' || kem == 'Y')
goto mulai;
else if (kem == 't' || kem == 'T')
goto tidak;}
}
tidak :
cout<<"--------------------------";
cout<<"\n==========================";
cout<<"\n\n...... TERIMA KASIH ......\n\n";
cout<<"==========================";
cout<<"\n--------------------------";
}