0% found this document useful (0 votes)
25 views2 pages

PENJUALAN

The document contains code for a C++ program that calculates sales transactions. It takes in a product code and quantity, looks up the product name and price, calculates subtotal, discount if over 3 items, and total payment amount.

Uploaded by

Dharman Capah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

PENJUALAN

The document contains code for a C++ program that calculates sales transactions. It takes in a product code and quantity, looks up the product name and price, calculates subtotal, discount if over 3 items, and total payment amount.

Uploaded by

Dharman Capah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<iostream.

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

void main()
{
    char kode[2];
    char* nama;
    int jumlah=0;
    long int harga,total,bayar;
    float diskon;

    cout << "-----Penjualan Barang-----" << endl;


    cout << "  Input Kode Barang : ";cin >> kode;
    cout << "  Jumlah Barang     : ";cin >> jumlah;

    if (kode=="B1")
        {nama="Laptop";harga=1000000;}
    else if(kode=="B2")
        {nama="Mouse";harga=60000;}
    else if (kode=="B3")
        {nama="Flash";harga=80000;}
    else if (kode=="B4")
        {nama="Monitor";harga=500000;}

    total=harga*jumlah;

    if (jumlah> 3)
        {diskon=total*0.1;}
    else
        {diskon=0;}

    bayar=total-diskon;

    clrscr();
    cout << "--------Penjualan Barang---------" << endl;
    cout << "---------------------------------" << endl;
    cout << "  Kode Barang         : " << kode << endl;
    cout << "  Nama Barang         : " << nama << endl;
    cout << "  Harga               : " << harga << endl;
    cout << "  Total Harga         : " << total << endl;
    cout << "  Diskon              : " << diskon << endl;
    cout << "  Total Bayar         : " << bayar << endl;
    cout << "---------------------------------" << endl;
    getch();
}

You might also like