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

Code Program Total Harga Dan Pembanyaran

This C++ program allows a user to input the name of a buyer, number of items bought, name and price of each item, and calculates the total cost. It prints a table with the item name, quantity, price and total for each row, and prints the grand total at the bottom. After getting all the input data, it displays a thank you message concluding the transaction.

Uploaded by

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

Code Program Total Harga Dan Pembanyaran

This C++ program allows a user to input the name of a buyer, number of items bought, name and price of each item, and calculates the total cost. It prints a table with the item name, quantity, price and total for each row, and prints the grand total at the bottom. After getting all the input data, it displays a thank you message concluding the transaction.

Uploaded by

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

#include<iostream.

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

/**
*bundet.com
*Total Belanja dan Pembayaran
*/

void main() {

char nama[30], barang[30];


int jumlah_barang, jumlah_beli = 0;
long harga_satuan, jumlah_harga, total_bayar = 0;

cout << "Nama Pembeli : " << endl;


cout << "Jumlah Barang yg Dibeli : " << endl;
gotoxy (27,1); cin >> nama;
gotoxy (27,2); cin >> jumlah_barang;
cout << endl;

cout << "====================================================================" <<


endl;
cout << "| NO | NAMA BARANG | JUMLAH BELI | HARGA SATUAN | JUMLAH HARGA |" <<
endl;
cout << "====================================================================" <<
endl;

for (int i = 1; i <= jumlah_barang; i++) {


gotoxy(1,i+6); cout << "|";
gotoxy(6,i+6); cout << "|";
gotoxy(24,i+6); cout << "|";
gotoxy(38,i+6); cout << "|";
gotoxy(53,i+6); cout << "|";
gotoxy(68,i+6); cout << "|";
gotoxy(3,i+6); cout << setw(2) << i;
}

cout << endl;


cout << "====================================================================" <<
endl;
cout << "| TOTAL | |" <<
endl;
cout << "====================================================================" <<
endl;

for (int j = 1; j <= jumlah_barang; j++) {


gotoxy(8,j+6); cin >> barang;
gotoxy(26,j+6); cin >> jumlah_beli;
gotoxy(40,j+6); cin >> harga_satuan;
jumlah_harga = jumlah_beli * harga_satuan;
gotoxy(55,j+6); cout << setw(12) << jumlah_harga;
total_bayar = total_bayar + jumlah_harga;
}
gotoxy(55,jumlah_barang+8); cout << setw(12) << total_bayar << endl;

gotoxy(1,jumlah_barang+11);cout << "TERIMA KASIH";

getch();
}

You might also like