BSI - LATIHAN SOAL STRUCTUR ALGORITMA DAN PEMROGRAMAN SEMESTER 1 ( RENTAL VCD THE ONE )

Semoga Bermanfaat untuk anda pelajari lagi
Jika ada kesalahan mohon diposkan komentar :) .
folloq : @Pray_N_Win

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
struct
{
char lagi, kode,lokal,judul_film[20],jenis_film[20];
int total,harga_sewa,lama_sewa;
}film;
lagi:
clrscr();
cout<<"    RENTAL VCD 'THE ONE'"<<endl;
cout<<"==========================="<<endl;
cout<<endl;
cout<<"MASUKAN KODE [A/B] : ";cin>>film.kode;
cout<<"FILM LOKAL   [Y/T] : ";cin>>film.lokal;
if(film.kode=='A' || film.kode=='a')
{
 strcpy(film.jenis_film,"ACTION");
 if(film.lokal=='Y' || film.lokal=='y')
 {
 strcpy(film.judul_film,"Naga Boneng");
 film.harga_sewa=4000;
 }

 else
 {
 strcpy(film.judul_film,"Transpotter");
 film.harga_sewa=4500;
 }
}
else
{
 strcpy(film.jenis_film,"HOROR");
 if(film.lokal=='Y' || film.lokal=='y')
 {
 strcpy(film.judul_film,"Suste Nengok");
 film.harga_sewa=4000;
 }
 else
 {
 strcpy(film.judul_film,"Ghostsip");
 film.harga_sewa=5000;
 }
}
cout<<"---------------------------"<<endl;
cout<<"JENIS FILM         : "<<film.jenis_film<<endl;
cout<<"JUDUL FILM         : "<<film.judul_film<<endl;
cout<<"HARGA SEWA         : "<<film.harga_sewa<<endl;
cout<<"Input LAMA SEWA    : ";cin>>film.lama_sewa;
cout<<"\t---------------------------"<<endl;
film.total=film.harga_sewa*film.lama_sewa;
cout<<"\tTOTAL BAYAR        : Rp "<<film.total<<endl;
cout<<"\tINPUT LAGI  [Y/T]  : ";cin>>film.lagi;
if(film.lagi=='Y' || film.lagi=='y')
goto lagi;
getch();
Previous
Next Post »