alexa-tracking

Help C++. Dikasih Cendol

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/539477ff507410b72b8b459b/help-c-dikasih-cendol
Help C++. Dikasih Cendol
Code:
#include<iostream>
#include<windows.h>
#include<conio.h>
#include<iomanip>
using namespace std;
class rental{
public:
void menuh();
void cek();
void pesan();
void trt();
void tp();};
void rental::menuh()
{ system("cls");
system("Color 04");
int pilih;
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<" 1. Cek Harga Penyewaan Mobil"<<endl;
cout <<" 2. Penyewaan Mobil"<<endl;
cout <<" 3. Tentang Rental TKJ"<<endl;
cout <<" 4. Tentang Program"<<endl;
cout <<" 5. Keluar"<<endl;
cout <<" Masukan Pilihan Anda = ";
cin>>pilih;
switch (pilih) {
case 1 : cek();
break;
case 2 : pesan();
break;
case 3 : trt();
break;
case 4 : tp();
break;
case 5 : system("cls");
cout<<endl<<endl<<"\t\t\t terimakasih telah berkunjung "<<endl<<endl;
cout<<"tekan enter untuk melanjutkan ";
getch();
menuh();
default : cout<<"menu tak tersedia"; exit(0);

}
}
void rental::cek(){
system("cls");
system("Color 01");
//int pilih;
int harga[3]={1000000,2000000,3000000};
//int lama,total,diskon;
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout<<" 1. Mobil Sedan "<<"\tRp "<<harga[0]<<ends<<"perhari"<<endl;
cout<<" 2. Mobil Pick Up "<<"\tRp "<<harga[1]<<ends<<"perhari"<<endl;
cout<<" 3. Mobil Bus "<<"\t\tRp "<<harga[2]<<ends<<"perhari"<<endl;
cout<<" 4. Harga Supir\tRp 500000"<<ends<<ends<<"perhari"<<endl;
cout<<" Tekan Enter untuk kembali"; getch();
menuh();}
void rental:emoticon-Stick Out Tongueesan(){
int pilih,lama,total,diskon,supir;
int harga[3]={1000000,200000,3000000};
char namad[30],namab[30];
char x;
system("cls");
system("Color 03");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<setw(9)<<""<<"\t\tDiskon 20% bila menyewa lebih dari 3 hari "<<endl<<endl<<endl;
cout<<" JENIS MOBIL"<<endl<<endl;
cout<<" 1. Sedan"<<endl;
cout<<" 2. Pick Up"<<endl;
cout<<" 3. Bus"<<endl<<endl;
cout<<" Masukan Pilihan Anda = ";
cin>>pilih;
switch (pilih) {
case 1 : system("cls");
system("Color 07");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<"\t\t\t\t PEMESANAN MOBIL "<<endl<<endl<<endl;
cout <<" MOBIL SEDAN"<<endl;
cout <<"---------------------------------"<<endl;
cout <<endl<<"Lama Menyewa Mobil = ";
cin>>lama;
cout<<endl<<"pakai supir? (y/t)"<<"\t"<<setw(5)<<"= "; cin>>x;
if(x=='y')
{
supir = lama * 500000;
}else
{
supir = lama*0;
}
cout <<endl<<"Masukan Nama Depan Anda = ";
cin>>namad;
cout <<endl<<"Masukan Nama Belakang Anda = ";
cin>>namab;
system("cls");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<"\t\t\t\t PEMESANAN Mobil "<<endl<<endl<<endl;
cout<<" Lama Pesan = "<<lama<<" Hari"<<endl;
cout<<" Nama = "<<namad<<" "<<namab<<endl;
if(lama>3){
diskon=20*lama*harga[0]/100;
total=(lama*harga[0]-diskon)+supir;
cout<<"_________________________________________"<<endl;
cout<<" Pembayaran "<<endl;
cout<<"_________________________________________"<<endl;
cout<<" Harga Per hari = Rp "<<harga[0]<<endl;
cout<<" Lama Menyewa = "<<lama<<" hari "<<endl;
cout<<" Diskon/Potongan = "<<diskon<<endl;
cout<<" Total = "<<total<<endl;
system("pause");
menuh();}
else{
total=lama*harga[0]+supir;
cout<<"_________________________________________"<<endl;
cout<<" Pembayaran"<<endl;
cout<<"_________________________________________"<<endl;
cout<<" Harga Per hari = Rp "<<harga[0]<<endl;
cout<<" Lama Menyewa = "<<lama<<" hari "<<endl;
cout<<" Total = "<<total<<endl;
system("pause");
menuh();}
break;
case 2 :
system("cls");
system("Color 07");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<"\t\t\t\t PEMESANAN Mobil "<<endl<<endl<<endl;
cout <<" Mobil Pick Up"<<endl;
cout <<"---------------------------------"<<endl;
cout <<endl<<"Lama Menyewa mobil; = ";
cin>>lama;
cout <<endl<<"Masukan Nama Depan Anda = ";
cin>>namad;
cout <<endl<<"Masukan Nama Belakang Anda = ";
cin>>namab;
system("cls");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<"\t\t\t\t PEMESANAN MOBIL "<<endl<<endl<<endl;
cout<<" Lama Menyewa = "<<lama<<" hari"<<endl;
cout<<" Nama = "<<namad<<" "<<namab<<endl;
if(lama>3){
diskon=20*lama*harga[1]/100;
total=(lama*harga[1]-diskon)+supir;
cout<<"_________________________________________"<<endl;
cout<<" Pembayaran "<<endl;
cout<<"_________________________________________"<<endl;
cout<<" Harga Per hari = Rp "<<harga[1]<<endl;
cout<<" Lama Menyewa = "<<lama<<" hari "<<endl;
cout<<" Diskon/Potongan = "<<diskon<<endl;
cout<<" Total = "<<total<<endl;
system("pause");
menuh();}
else{
total=lama*harga[1]+supir;
cout<<"_________________________________________"<<endl;
cout<<" Pembayaran"<<endl;
cout<<"_________________________________________"<<endl;
cout<<" Harga Per hari = "<<harga[1]<<endl;
cout<<" Lama Menyewa = "<<lama<<" hari "<<endl;
cout<<" Total = "<<total<<endl;
system("pause");
menuh();}
break;
case 3 :
system("cls");
system("Color 07");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<"\t\t\t\t PEMESANAN Mobil "<<endl<<endl<<endl;
cout <<" Mobil BUS"<<endl;
cout <<"---------------------------------"<<endl;
cout <<endl<<"Lama Menyewa = ";
cin>>lama;
cout <<endl<<"Masukan Nama Depan Anda = ";
cin>>namad;
cout <<endl<<"Masukan Nama Belakang Anda = ";
cin>>namab;
system("cls");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<"\t\t\t\tPEMESANAN Bus "<<endl<<endl<<endl;
cout<<" Lama Menyewa = "<<lama<<" Hari"<<endl;
cout<<" Nama = "<<namad<<" "<<namab<<endl;
if(lama>3){
diskon=20*lama*harga[2]/100;
total=(lama*harga[2]-diskon)+supir;
cout<<"_________________________________________"<<endl;
cout<<" Pembayaran "<<endl;
cout<<"_________________________________________"<<endl;
cout<<" Harga Per hari = Rp "<<harga[2]<<endl;
cout<<" Lama Menyewa = "<<lama<<" hari "<<endl;
cout<<" Diskon/Potongan = "<<diskon<<endl;
cout<<" Total = "<<total<<endl;
system("pause");
menuh();}
else{
total=lama*harga[2];
cout<<"_________________________________________"<<endl;
cout<<" Pembayaran"<<endl;
cout<<"_________________________________________"<<endl;
cout<<" Harga Per hari = Rp "<<harga[2]<<endl;
cout<<" Lama Menyewa = "<<lama<<" hari "<<endl;
cout<<" Total = "<<total<<endl;
system("pause");
menuh();}
break;
default : menuh();
}
}
void rental::trt(){
system("cls");
system("Color 05");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<" Selamat Datang Di Rental TKJ, Saya selaku pihak manajemen mengucapkan banyak"<<endl;
cout <<"terima kasih atas kepercayaan anda memilih rental Saya sebagai jasa penyedia kendaraan"<<endl;
cout <<" Semoga anda nyaman dengan kendaraan yang Saya sewakan."<<endl;
cout <<endl<<endl<<" FASILITAS Mobil"<<endl<<endl;
cout <<" 1. mobil sedan "<<endl;
cout <<"\t a. 6 kursi"<<endl;
cout <<"\t b. bagasi luas"<<endl;
cout <<" 2. mobil pick up"<<endl;
cout <<"\t a. 2 kursi"<<endl;
cout <<"\t b. Rak Sepeda"<<endl;
cout <<" 1. Mobil Bus"<<endl;
cout <<"\t a. 40 Kursi seat 2-2"<<endl;
cout <<"\t b. AC"<<endl;
cout <<"\t c. TOILET"<<endl;
cout <<"\t b. TV"<<endl;
cout <<"\t d. DVD"<<endl;
system("pause");
menuh();}
void rental::tp(){
system("cls");
system("Color 06");
cout <<"\t\t\t||================================||"<<endl;
cout <<"\t\t\t|| SELAMAT DATANG DI Rental TKJ ||"<<endl;
cout <<"\t\t\t||================================||"<<endl<<endl;
cout <<"\n\n TIM PENYUSUN"<<endl<<endl;
cout <<" Dimas Rangga Respati || TKJ 2A || 4313111011"<<endl;
cout <<" para timsukses dari TKJ 4"<<endl;
cout <<" Koalisi tanpa syarat dengan TKJ 2A"<<endl;
system("pause");
menuh();}
main(){
rental h;
cout<<"\t\t\t(===========================)"<<endl;
cout<<"\t\t\t || ||"<<endl;
cout<<"\t\t\t || ||"<<endl;
cout<<"\t\t\t || Rental Mobil ||"<<endl;
cout<<"\t\t\t || ||"<<endl;
cout<<"\t\t\t || ||"<<endl;
cout<<"\t\t\t || TKJ ||"<<endl;
cout<<"\t\t\t ||_______________________||"<<endl;
cout<<"\t\t\t(===========================)"<<endl;
system("Color 07");
getch();
h.menuh();
}

Help C++. Dikasih Cendol
itu cara output total disimpen jadi txt gimana ya?
#include <iostream>
#include <fstream>
using namespace std;

int main ()
{
  ofstream myfile;
  myfile.open ("coba.txt");
  myfile << "menulis di file coba.\n";
  myfile.close();
  return 0;
}
×