#include <iostream>
#include <string>
#include <stdio.h>
#include <fstream>
#include <conio.h>
#include <cstdlib>
using namespace std;
struct data_BBM{
string kode_BBM;
string nama_BBM;
int harga;
};
// syntax program yang akan menjalankan program
int main()
{
int input;
string nama_penjaga, jenis, code;
data_BBM BBM;
string kode_BBM[4]={"1", "2", "3", "4"};
string nama_BBM[4]={"Premium", "Pertalite", "Solar", "Pertamax"};
int jml_uang, kembali, total=0;
string no_pompa, no_selang;
float liter, harga, uang;
ofstream varfile;
cout<< "======================================="<<endl;
cout<< " Selamat Datang di SPBU jozz gandoss "<<endl;
cout<< " Jalan anyar koe karo sopo?!! "<<endl;
cout<< "======================================="<<endl;
cout<< "List Harga BBM : "<<endl;
cout<< "Kode Jenis BBM Harga "<<endl;
cout<< " 1 Premium Rp. 8.500,00"<<endl;
cout<< " 2 Pertalite Rp. 9.500,00"<<endl;
cout<< " 3 Solar Rp. 7.500,00"<<endl;
cout<< " 4 Pertamax Rp. 10.300,00"<<endl;
cout<< "---------------------------------------"<<endl;
cout << "Kode BBM : "; cin >> BBM.kode_BBM;
if (BBM.kode_BBM == "1"){
cout << "Jenis BBM : "<<nama_BBM[0]<<endl;
cout << "Rp. 8.500/liter";
jenis = "Premium";
harga = 8500;
nama_penjaga = "Harun setiaji";
no_pompa = "1";
no_selang = "1";
}
else if (BBM.kode_BBM == "2"){
cout << "Jenis BBM : "<<nama_BBM[1]<<endl;
cout << "Rp. 7.500/liter";
jenis = "Pertalite";
harga = 9500;
nama_penjaga = "Yoga firza";
no_pompa = "2";
no_selang = "2";
}
else if (BBM.kode_BBM == "3"){
cout << "Jenis BBM : "<<nama_BBM[2]<<endl;
cout << "Rp. 7.500/liter";
jenis = "Solar";
harga = 7500;
nama_penjaga = "Yoga firza";
no_pompa = "3";
no_selang = "3";
}
else if (BBM.kode_BBM == "4"){
cout << "Jenis BBM : "<<nama_BBM[3]<<endl;
cout << "Rp. 10.300/liter";
jenis = "Pertamax";
harga = 10300;
nama_penjaga = "Harun setiaji";
no_pompa = "4";
no_selang = "4";
}
else {
cout << "Maaf anda salah memasukkan kode BBM"<<endl;
}
cout << "\nBeli rupiah : "; cin >> uang;
cout << "Bayar : "; cin >> jml_uang;
total = total + uang;
liter = uang / harga;
kembali = jml_uang - uang;
system("cls");
varfile.open("data2.txt");
if (varfile == NULL){
cout<<"File gagal di buka";
}
else{
varfile<< " >>> SPBU JOZ GANDOS <<< "<<endl;
varfile<< " >>>Jl. Neng dalan anyar koe karo sopo?!! <<< "<<endl;
varfile<< " >>> Telp 03030 <<< "<<endl;
varfile<< "\n======================================================"<<endl;
varfile<< "\nNomor Pompa : "<<no_pompa<<endl;
varfile<< "Nomor Selang : "<<no_selang<<endl;
// cout << "Nomor Plat : "<<plat<<endl;
varfile<< "Jenis BBM : "<<jenis<<endl;
varfile<< "Liter : "<<liter<<endl;
varfile<< "Harga/liter : Rp. "<<harga<<",00"<<endl;
varfile<< "Total : Rp. "<<total<<",00"<<endl;
varfile<< "Bayar : Rp. "<<jml_uang<<",00"<<endl;
varfile<< "Kembali : Rp. "<<kembali<<",00"<<endl;
varfile<< "\n======================================================"<<endl;
varfile<< "Operator : "<<nama_penjaga<<endl;
varfile<< " BBM subsidi untuk golongan TIDAK MAMPU "<<endl;
varfile<< " TERIMA KASIH DAN SELAMAT JALAN ";
varfile.close();
}
return 0;
}