Selamat datang di Mahasiwa Lugu

Penggabungan C++ (STRUKTUR,ARRAY,FUNGSI,FOR,GOTO)

Wednesday, December 26, 20120 komentar

Liburan dateng gw udah seneng banget... eehh ternyata dosen pemrograman gw ngasih tugas yang bikin otak gw muter-muter... tuh dosen ngasih tugas menggabungkan program dari 5 materi yang pernah diberikan yaitu STRUKTUR,ARRAY,FUNGSI,FOR,GOTO

Seperti biasa sebelum gw ngerjain ini tugas gw ngelakuin ritual gw yaitu pergi ke jamban supaya dapet inspirasi :D #LOL.... jadi curhat gni nie gw. :D
yaudah langsung liat aja  scriptnya di bawah...

Nie gan n sist tampilan awal program yang ane bikin... sedikit di berikan variasi :D


Ini tampilan Saat Input Pemesanan Tiket Karimun Jawa Tour

Nah ini tampilan outputnya

 Untuk source code bisa di lihat di bawah ini...

#include<stdio.h>
#include<conio.h>
#include<iomanip.h>
#include<iostream.h>


/* Created By Heru Junot Ali CEO Mahasiswa-Lugu.tk */
penyusun()
{
cout<<"         TUGAS ALGORITMA PEMROGRAMAN"<<endl;
cout<<" PENGGABUNGAN(STRUKTUR,ARRAY,FUNGSI,FOR,GOTO)"<<endl;
cout<<" ============================================"<<endl;
cout<<"|   NIM    |              NAMA               |"<<endl;
cout<<"|============================================|"<<endl;
cout<<"| 12124732 |  Apriyanto Ramdhan              |"<<endl;
cout<<"| 18122137 |  Armelia Tifani                 |"<<endl;
cout<<"| 12124110 |  Derry Quese                    |"<<endl;
cout<<"| 12124727 |  Heru Pramono                   |"<<endl;
cout<<"| 12124414 |  Miftahul Ramadhan Mulki        |"<<endl;
cout<<"| 12124747 |  Romi Baskoro                   |"<<endl;
cout<<"| 12124729 |  Syaiful Richwan                |"<<endl;
cout<<" ============================================"<<endl;
}

menu()
{
cout<<" ==============================================================="<<endl;
cout<<"|                 DAFTAR PAKET KARIMUN JAWA TOUR                |"<<endl;
cout<<" ==============================================================="<<endl;
cout<<"| Kode Paket |     Nama Paket      |  Lama Inap   |    Harga    |"<<endl;
cout<<"|===============================================================|"<<endl;
cout<<"|    KR01    | Real Backpacker     | 3hari 2malam | Rp. 600.000 |"<<endl;
cout<<"|            |                     | 4hari 3malam | Rp. 650.000 |"<<endl;
cout<<"|---------------------------------------------------------------|"<<endl;
cout<<"|    KR02    | Super Backpacker    | 3hari 2malam | Rp. 625.000 |"<<endl;
cout<<"|            |                     | 4hari 3malam | Rp. 700.000 |"<<endl;
cout<<"|---------------------------------------------------------------|"<<endl;
cout<<"|    KR03    | Reguler Backpacker  | 3hari 2malam | Rp. 800.000 |"<<endl;
cout<<"|            |                     | 4hari 3malam | Rp. 850.000 |"<<endl;
cout<<" ==============================================================="<<endl;
cout<<"                   HARGA BELUM TERMASUK PPN 10%"<<endl;
cout<<"                   ----------------------------"<<endl;
}

judul()
{
cout<<" ==============================================================="<<endl;
cout<<"                        KARIMUN JAWA TOUR"<<endl;
cout<<" ==============================================================="<<endl;
}

garis()
{
cout<<"=============================================================================="<<endl;
}

long ttlhrg(long hrg,long jbl)
{
return(hrg*jbl);
}
long grand(long tlsub,long pjk)
{
return(tlsub+pjk);
}

long kembali(long uby,long grnd)
{
return(uby-grnd);
}

main()
{
char lagi;
int no,jt,a;
long gt,ubay,ukem;
long ppn,subtotal;

{
char mau;
penyusun();
cout<<"  INGIN MELIHAT PROGRAM?? [Y/T] : ";cin>>mau;
if(mau=='y'||mau=='Y')
goto awal;
else
goto akhir;
}

struct
{
 char kopak[30],napak[25],lama[20],lain[25];
 int harga,jumbel;
 long tohar;
}karimun[20];

awal:
clrscr();
subtotal=0;
menu();
cout<<endl;
judul();
cout<<" No. Nota               : ";cin>>no;
cout<<" Jumlah Transaksi       : ";cin>>jt;
cout<<endl;

for(a=1;a<=jt;a++)
{
 cout<<" Transaksi ke - "<<a<<endl;
 cout<<" Kode Paket             : ";cin>>karimun[a].kopak;
 cout<<" Lama Inap [3H2M/4H3M]  : ";cin>>karimun[a].lama;
 if(!strcmp(karimun[a].kopak,"KR01")||!strcmp(karimun[a].kopak,"kr01"))
  {
   strcpy(karimun[a].napak,"Real Backpacker");
   if(!strcmp(karimun[a].lama,"3H2M")||!strcmp(karimun[a].lama,"3h2m"))
   {
    strcpy(karimun[a].lain,"3Hari 2Malam");
    karimun[a].harga=600000;
    }
   else
   {
    strcpy(karimun[a].lain,"4Hari 3Malam");
    karimun[a].harga=650000;
    }
   }
 else if(!strcmp(karimun[a].kopak,"KR02")||!strcmp(karimun[a].kopak,"kr02"))
  {
   strcpy(karimun[a].napak,"Super Backpacker");
   if(!strcmp(karimun[a].lama,"3H2M")||!strcmp(karimun[a].lama,"3h2m"))
   {
    strcpy(karimun[a].lain,"3Hari 2Malam");
    karimun[a].harga=625000;
    }
   else
   {
    strcpy(karimun[a].lain,"4Hari 3Malam");
    karimun[a].harga=700000;
    }
   }
 else if(!strcmp(karimun[a].kopak,"KR03")||!strcmp(karimun[a].kopak,"kr03"))
   {
    strcpy(karimun[a].napak,"Reguler Backpacker");
    if(!strcmp(karimun[a].lama,"3H2M")||!strcmp(karimun[a].lama,"3h2m"))
    {
     strcpy(karimun[a].lain,"3Hari 2Malam");
     karimun[a].harga=800000;
     }
    else
    {
     strcpy(karimun[a].lain,"4Hari 3Malam");
     karimun[a].harga=850000;
     }
    }
 else
  {
   strcpy(karimun[a].napak,"SALAH KODE");
   karimun[a].harga=0;
   }
 cout<<" Nama Paket             : "<<karimun[a].napak<<endl;
 cout<<" Harga Tiket            : Rp."<<karimun[a].harga<<endl;
 cout<<" Jumlah Beli            : ";cin>>karimun[a].jumbel;
 karimun[a].tohar=ttlhrg(karimun[a].harga,karimun[a].jumbel);
 cout<<" Total Harga            : Rp."<<karimun[a].tohar;
 cout<<endl<<endl;
}
clrscr();
garis();
cout<<"No  Kode   Nama                 Lama           Harga     Jumlah    Total"<<endl;
cout<<"    Paket  Paket                Inap           Tiket     Beli"<<endl;
garis();
for(a=1;a<=jt;a++)
{
 cout<<setiosflags(ios::left)<<setw(4)<<a;
 cout<<setiosflags(ios::left)<<setw(7)<<karimun[a].kopak;
 cout<<setiosflags(ios::left)<<setw(21)<<karimun[a].napak;
 cout<<setiosflags(ios::left)<<setw(15)<<karimun[a].lain;
 cout<<setiosflags(ios::left)<<setw(10)<<karimun[a].harga;
 cout<<setiosflags(ios::left)<<setw(10)<<karimun[a].jumbel;
 cout<<setiosflags(ios::left)<<setw(13)<<karimun[a].tohar<<endl;
 subtotal=subtotal+karimun[a].tohar;
}
garis();
cout<<"\t\t\t\t\t\tSubtotal    : Rp."<<subtotal<<endl;
ppn=0.1*subtotal;
cout<<"\t\t\t\t\t\tPPN 10%     : Rp."<<ppn<<endl;
gt=grand(subtotal,ppn);
cout<<"\t\t\t\t\t\tGrand Total : Rp."<<gt<<endl;
cout<<"\t\t\t\t\t\tUang Bayar  : Rp.";cin>>ubay;
ukem=kembali(ubay,gt);
cout<<"\t\t\t\t\t\tkembalian   : Rp."<<ukem<<endl;
cout<<endl<<endl;
cout<<"\t\t\tInput Data Lagi [Y/T]: ";cin>>lagi;
if(lagi=='y'||lagi=='Y')
goto awal;
else
goto akhir;
getch();
akhir:
}


Jangan Lupa Tinggalin Komentar & Likenya ya Bro n Sist :D
Indahnya Berbagi

Share this article :
Comments
0 Comments

Post a Comment

 

Copyright © 2012. Mahasiswa Lugu™ - All Rights Reserved

Powered by Mahasiswa Lugu