Sie sind auf Seite 1von 7

Algoritma pt13

 

Disusun oleh

Acep 2022340007

JURUSAN TEKNIK INFORMATIKA AND RPL

FAKULTAS INFORMATIKA

UNIVERSITAS BINA INSANI

BEKASI

2022

#include <conio.h>

#include <iostream>
#include <string.h>

#include<stdlib.h> /*for system()*/

using namespace std;

int main()

struct

{ char kode[3], kelas, nama_orang[20], nama_kereta[15], nama_kelas[20];

int jumbel, harga;

long bayar, diskon, pembayaran, tot_bay, uang_kem;

}tiket;

char lagi;

atas:

cout<<"=================================================="<<endl;

cout<<"===========BEKASI INTERNASIONAL STASIUN==========="<<endl;

cout<<"=================================================="<<endl;

cout<<"Kode kereta[AG/AL/PH]\t\t: ";cin>>tiket.kode;

cout<<"Kelas kereta[1/2/3]\t\t: ";cin>>tiket.kelas;

cout<<"Nama pemesan\t\t\t: ";cin>>tiket.nama_orang;

cout<<"=================================================="<<endl;

cout<<"===========BEKASI INTERNASIONAL STASIUN==========="<<endl;

cout<<"=================================================="<<endl;

if (strcmp(tiket.kode, "AG")==0)

strcpy(tiket.nama_kereta, "Argo Bromo");


if (tiket.kelas=='1')

strcpy(tiket.nama_kelas, "Executive");

tiket.harga=800000;

else if(tiket.kelas=='2')

strcpy(tiket.nama_kelas, "Bisnis");

tiket.harga=500000;

else if(tiket.kelas=='3')

strcpy(tiket.nama_kelas, "Ekonomi");

tiket.harga=250000;

else

{strcpy(tiket.nama_kelas, "salah kode");

}}

if (strcmp(tiket.kode, "AL")==0)

strcpy(tiket.nama_kereta, "Argo lawu");

if (tiket.kelas=='1')

{strcpy(tiket.nama_kelas, "Executive");

tiket.harga=700000;}

else if(tiket.kelas=='2')

{strcpy(tiket.nama_kelas, "Bisnis");

tiket.harga=400000;}

else if(tiket.kelas=='3')

{strcpy(tiket.nama_kelas, "Ekonomi");

tiket.harga=200000;}
else

{strcpy(tiket.nama_kelas, "salah kode");

}}

if (strcmp(tiket.kode, "PH")==0)

strcpy(tiket.nama_kereta, "Parahyangan");

if (tiket.kelas=='1')

{strcpy(tiket.nama_kelas, "Executive");

tiket.harga=600000;}

else if(tiket.kelas=='2')

{strcpy(tiket.nama_kelas, "Bisnis");

tiket.harga=350000;}

else if(tiket.kelas=='3')

{strcpy(tiket.nama_kelas, "Ekonomi");

tiket.harga=175000;}

else

{strcpy(tiket.nama_kelas, "salah kode");

cout<<"Nama Pemesan :"<<tiket.nama_orang<<endl;

cout<<"Nama Kereta :"<<tiket.nama_kereta<<endl;

cout<<"Kelas kereta :"<<tiket.kelas<<endl;

cout<<"Nama kelas :"<<tiket.nama_kelas<<endl;

cout<<"Harga pertiket :"<<tiket.harga<<endl;

cout<<"Jumlah pemesanan :";cin>>tiket.jumbel;

tiket.bayar=tiket.jumbel*tiket.harga;
system("cls") /*clear output screen*/;

if (tiket.jumbel>=10)

{tiket.diskon=tiket.bayar*0.25;}

else if (tiket.jumbel>5)

{tiket.diskon=tiket.bayar*0.1;}

else

{tiket.diskon=tiket.bayar*0;}

cout<<"Pembayaran :"<<tiket.bayar<<endl;

cout<<"diskon :"<<tiket.diskon<<endl;

cout<<"=================================================="<<endl;

tiket.tot_bay=tiket.bayar-tiket.diskon;

cout<<"Total pembayaran :"<<tiket.tot_bay<<endl;

cout<<"Uang Pembayaran :";cin>>tiket.pembayaran;

tiket.uang_kem=tiket.pembayaran-tiket.tot_bay;

cout<<"uang kembali :"<<tiket.uang_kem<<endl;

cout<<""<<endl;

cout<<""<<endl;

cout<<"ingin pilih lagi[y/t] =";cin>>lagi;

if(lagi=='y' || lagi=='Y')

goto atas;

getch();

}
Outputnya

Das könnte Ihnen auch gefallen