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

Share Make Be Easy: Latihan ARRAY (Urutan)

This document contains code for a C++ program that calculates the total price of chicken orders. It defines arrays to store order details like item type, price, and quantity. It prompts the user to enter the number of items and then loops to get the type, price based on type, and quantity for each item. It calculates subtotals, taxes, and total price. Finally, it prints a report of the order details and totals.

Uploaded by

Sasuke Gaul
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views2 pages

Share Make Be Easy: Latihan ARRAY (Urutan)

This document contains code for a C++ program that calculates the total price of chicken orders. It defines arrays to store order details like item type, price, and quantity. It prompts the user to enter the number of items and then loops to get the type, price based on type, and quantity for each item. It calculates subtotals, taxes, and total price. Finally, it prints a report of the order details and totals.

Uploaded by

Sasuke Gaul
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SHARE MAKE BE EASY

Latihan ARRAY (urutan)


#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
main()
{ char jenis[20][20],kdjenis[20];
int i, jmlpot ;
float banyak[20],jmlharga[20],harga[20],totb,ppn,totjml,total;
clrscr();
printf("*****Ayam Goreng Fried Chicken*****\n");
printf("========================\n");
printf(" Kode
Jenis potong
Harga\n");
printf("=============================\n");
printf(" D
Dada
3000 \n");
printf(" P
Paha
2500 \n");
printf(" S
Sayap
1500 \n");
printf("=============================\n");
cout<<"Masukan Jumlah Data : ";cin>>jmlpot;
for (i=1;i<=jmlpot;i++)
{
//clrscr();
cout<<"Jenis Ayam ke- "<<i<<endl;
cout<<"Jenis Ayam Bagian [D/P/S] : ";cin>>kdjenis[i];
cout<<"Jumlah Beli / Potong
: ";cin>>banyak[i];
if (kdjenis[i]=='D')
{
strcpy(jenis[i],"Dada");
harga[i]=3000;
}
else if (kdjenis[i]=='P')
{
strcpy(jenis[i],"Paha");
harga[i]=2500;
}
else if (kdjenis[i]=='S' )
{
strcpy(jenis[i],"Sayap");
harga[i]=1500;
}
else
{
strcpy(jenis[i],"Kepala");
harga[i]=1000;

Borland C++

Created By F@Y

SHARE MAKE BE EASY


}
jmlharga[i]=harga[i]*banyak[i];
totb=totb+jmlharga[i];
ppn=totb*0.1;
totjml=totjml+banyak[i];
total=totb+ppn;
}
clrscr();
cout<<"
PROGRAM AYAM GORENG FRIED CHICKEN
"<<endl;
cout<<"================================================="<<endl;
cout<<"NO JENIS POTONG

HARGA

BELI

JUMLAH HARGA "<<endl<<endl;

cout<<"================================================="<<endl;
for (i=1;i<=jmlpot;i++)
{
cout<<setiosflags(ios::left)<<setw(10)<<i;
cout<<setiosflags(ios::left)<<setw(20)<<jenis[i];
cout<<setiosflags(ios::left)<<setw(15)<<harga[i];
cout<<setiosflags(ios::left)<<setw(15)<<banyak[i];
cout<<setiosflags(ios::right)<<setw(5)<<jmlharga[i]<<endl;
}
cout<<"================================================="<<endl;
cout<<"
Jumlah Potong : "<<totjml<<endl;
cout<<"
Jumlah bayar : "<<totb<<endl;
cout<<"
PPN 10 %
: "<<ppn<<endl;
cout<<"
Total bayar
: "<<total;
getch();
}

Borland C++

Created By F@Y

You might also like