Minggu, 28 Oktober 2012

Program Penjualan (if else)

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

main()
{

char jenis, ukuran, lagi;
int harga, jumlah;
long int total, jumbay, jk;

textcolor(10);

atas:
clrscr();

cprintf("*******************************************************");cout<<endl;
cprintf("*                 JEANS IPRIT - FIRMAN                *");cout<<endl;
cprintf("*******************************************************");cout<<endl;
cprintf("*     JENIS      *      UKURAN      *      HARGA      *");cout<<endl;
cprintf("*******************************************************");cout<<endl;
cprintf("*                *        S         *      25000      *");cout<<endl;
cprintf("*       K        *        M         *      35000      *");cout<<endl;
cprintf("*                *        L         *      45000      *");cout<<endl;
cprintf("*******************************************************");cout<<endl;
cprintf("*                *        S         *      30000      *");cout<<endl;
cprintf("*       D        *        M         *      50000      *");cout<<endl;
cprintf("*                *        L         *      70000      *");cout<<endl;
cprintf("*******************************************************");cout<<endl;
cprintf("*                *        S         *      40000      *");cout<<endl;
cprintf("*       C        *        M         *      55000      *");cout<<endl;
cprintf("*                *        L         *      75000      *");cout<<endl;
cprintf("*******************************************************");cout<<endl;
cout<<endl;


cout<<"  Pilih Jenis Celana Jeans  [K/D/C] : ";cin>>jenis;
cout<<"  Pilih Ukuran Celana Jeans [S/M/L] : ";cin>>ukuran;

if (jenis=='K' || jenis=='k')
{
 if (ukuran=='S'|| ukuran=='s')
     harga=25000;
 else if (ukuran=='M'|| ukuran=='m')
     harga=35000;
 else
     harga=45000;
 }
else
if (jenis=='D' || jenis=='d')
{
 if (ukuran=='S'|| ukuran=='s')
     harga=30000;
 else if (ukuran=='M'|| ukuran=='m')
     harga=50000;
 else
     harga=70000;
 }
else
{
 if (ukuran=='S'|| ukuran=='s')
     harga=40000;
 else if (ukuran=='M'|| ukuran=='m')
     harga=55000;
 else
     harga=75000;
 }
cout<<endl;
cprintf("*******************************************************");
cout<<endl;
cout<<endl;
cout<<"  Jenis Celana Jeans yang dipilih   : "<<jenis<<endl;
cout<<"  Ukuran Celana Jeans yang dipilih  : "<<ukuran<<endl;
cout<<"  Harga Celana Jeans                : Rp "<<harga<<endl;
cout<<"  Jumlah yang dibeli                : ";cin>>jumlah;endl;

total=harga*jumlah;

cout<<"  Total Bayar                       : Rp "<<total;endl;
cout<<endl;
cout<<endl;

cprintf("*******************************************************");
cout<<endl;
cout<<endl;
cout<<"  Jumlah bayar                      : Rp ";cin>>jumbay;
jk=jumbay-total;
cout<<"  Jumlah Kembali                    : Rp "<<jk<<endl;

cout<<endl;
cprintf("*******************************************************");
cout<<endl;
cprintf(" *       TERIMA  KASIH  ATAS  KUNJUNGAN  ANDA !      * ");
cout<<endl;
cprintf("*******************************************************");
cout<<endl;
cout<<endl;
cout<<"Ingin Input Data Lagi [Y/T]? ";cin>>lagi;endl;
if(lagi=='y' || lagi=='Y')

goto atas;

getch();

Tampilan pada program


 Walaupun agak norak ga apa deh, yang ngejreng kan yang menarik. haha

Tidak ada komentar:

Posting Komentar