Program penjualan sederhana dengan input adalah jumlah barang, nama pegawai, hari transaksi dan rincian item barang yang dibeli
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
main()
{
struct
{
char kode[7],nmbrg[50];
float hrg,total,jml;
}terima[8];
clrscr();
awal:
int al,bair;
char nmpeg[30],tgl[40],jwb;
float tlitm=0,hrgtl=0;
cout<<"\t \t \t \t PT.FADHLAN"<<endl;
cout<<"----------------------------------------------------------------------"<<endl;
cout<<"Input Jumlah Barang\t= ";cin>>al;
cout<<"Nama Pegawai Pencatat\t= ";cin>>nmpeg;
cout<<"Hari Pencatatan\t\t= ";cin>>tgl;
cout<<"----------------------------------------------------------------------"<<endl;
cout<<"\t \t \t Rincian Data Barang"<<endl;
cout<<"----------------------------------------------------------------------"<<endl;
for(bair=1;bair<=al;bair++)
{
cout<<"Data Barang Ke\t= "<<bair<<endl;
cout<<"Kode Barang\t= ";cin>>terima[bair].kode;
cout<<"Nama Barang\t= ";cin>>terima[bair].nmbrg;
cout<<"Jumlah Barang\t= ";cin>>terima[bair].jml;
kembali:
cout<<"Harga Beli\t= ";cin>>terima[bair].hrg;
if(terima[bair].hrg<=0)
{
cout<<"Harga yang diinput salah"<<endl;
goto kembali;
}
terima[bair].total=terima[bair].jml*terima[bair].hrg;
}
clrscr();
cout<<"\t\t\t Laporan Data Barang"<<endl;
cout<<"\t\t\t PT.FADHLAN"<<endl<<endl;
cout<<"Tanggal\t= "<<tgl;
cout<<"\t\t Nama Pencatatan = "<<nmpeg<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
cout<<"No Kode Nama Barang Jumlah Harga Total"<<endl;
cout<<"\tBarang"<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
for(bair=1;bair<=al;bair++)
{
cout<<setiosflags(ios::left)<<setw(9)<<bair;
cout<<setiosflags(ios::left)<<setw(12)<<terima[bair].kode;
cout<<setiosflags(ios::left)<<setw(13)<<terima[bair].nmbrg;
cout<<setiosflags(ios::left)<<setw(9)<<terima[bair].jml;
cout<<setiosflags(ios::left)<<setw(10)<<terima[bair].hrg;
cout<<setiosflags(ios::left)<<setw(8)<<terima[bair].total;
cout<<endl;
//coutlanjutan struct
hrgtl=hrgtl+terima[bair].total;
tlitm=tlitm+terima[bair].jml;
}
cout<<"-------------------------------------------------------------------------"<<endl;
cout<<"Rincian :"<<endl;
cout<<"Harga Total\t = "<<hrgtl<<endl;
cout<<"Keterangan :"<<endl;
cout<<"Total Item\t = "<<tlitm<<endl;
cout<<endl;
cout<<"Mau isi data lagi [y/t]\t = ";cin>>jwb;
if(jwb=='Y'||'y')
goto awal;
getch();
}
Input
output:
https://uts-sumbawa.ac.id
https://widiartaimade.blogspot.com
Related Posts :
- Back to Home »
- Program penjualan sederhana dengan input adalah jumlah barang, nama pegawai, hari transaksi dan rincian item barang yang dibeli
gk ada yang bahasa C ya kak?
BalasHapus