laporan harian 1
mitraKukar01
c_cpp
3 years ago
3.0 kB
13
Indexable
#include <iostream>
#include <string.h> // getline
#include <cstdlib> // untuk clear layar menggunakan kode ansi
#include <unistd.h> // untuk kata sleep
#include <locale>
#include <memory>
// #include <iomanip>
// #include <Windows.h> // untuk syntax didalam windows 10
using namespace std;
string clear = "\033[H\033[2J"; // untuk clear layar menggunakan kode ansi
struct separate_thousands : std::numpunct<char> {
char_type do_thousands_sep() const override { return '.'; } // separate with commas
string_type do_grouping() const override { return "\3"; } // groups of 3 digit
};
string dataTamu(char namaTamu[], string &checkin, string &checkout){
cout << "Nama Tamu: "; cin >> namaTamu; gets(namaTamu);
cout << "Tanggal Check In: "; cin >> checkin; gets(checkin);
cout << "Tanggal Check Out : "; cin >> checkout; gets(checkout);
return namaTamu, checkin, checkout;
}
int dataPesanan(int &lamaInap, int &pKodeKamar){
cout << "Lama Menginap : "; cin >> lamaInap;
cout << "Kode Kamar : "; cin >> pKodeKamar;
return lamaInap, pKodeKamar;
}
void FakturTamu(char namaTamu[], string checkin, string checkout, string namaKamar[], int pKodeKamar, int n, int kodeKamar[], int hargaKamar[], int lamaInap){
cout << clear;
dataTamu(namaTamu, checkin, checkout);
dataPesanan(lamaInap, pKodeKamar);
auto thousands = std::make_unique<separate_thousands>();
std::cout.imbue(std::locale(std::cout.getloc(), thousands.release()));
cout << "\n\nNama Tamu: " << namaTamu << endl;
cout << "Check In: " << checkin << endl;
cout << "Lama Menginap : " << lamaInap << endl;
for(int i = 0; i<n; i++){
if(kodeKamar[i] == pKodeKamar){
cout << "Kode Kamar : " << kodeKamar[i] << endl;
cout << "Harga Kamar : " << hargaKamar[i] << endl;
cout << "Nama Kamar : Rp. " << namaKamar[i] << endl;
}
}
}
void LaporanHarian(){
}
int main(){
int entry, lamaInap, pKodeKamar, kodeKamar[] = {101, 202, 303}, hargaKamar[] = {1000000, 600000, 450000}, n = sizeof(kodeKamar)/sizeof(kodeKamar[0]);
char namaTamu[20];
string button, checkin, checkout, namaKamar[] = {"Deluxe", "Standard", "Ekonomi"};
bool isTrue = true;
// system("COLOR 17");
do{
cout << clear;
cout << "1. Faktur Tamu\n2. Laporan Harian\n3. Exit\nPilih: "; cin >> entry;
if(entry == 1){
FakturTamu(namaTamu, checkin, checkout, namaKamar, pKodeKamar, n, kodeKamar, hargaKamar, lamaInap);
sleep(3);
break;
}
else if(entry == 2){
cout << clear;
cout << "Laporan harian\n\n"; //Laporan harian
sleep(3);
break;
}
else if(entry == 3){
cout << clear;
cout << "Good Bye\n\n"; //Laporan harian
// do{system("pause");
// }while(button == " ");
isTrue = false;
sleep(3);
break;
}
}while (isTrue != false);
}Editor is loading...