Tugas Ke 4 Program C++ Hasil Penjualan Barang/Produk

#include
#include
#include
#include
#include
void main()
{
char kd;
char nm[30];
char *nama;
char *jenis;
int jumlah, jns;
float harga=0;
long total;
char lagi='y';
clrscr();
while(lagi=='Y'||lagi=='y')
{
gotoxy(10,5);
cout<<"penjualan barang elektronik\n";
gotoxy(10,6);
cout<<"------------------------------\n";
gotoxy(10,7);
cout<<"nama pembeli="; cin>>nm;
gotoxy(10,8);
cout<<"kode barang[A/B/C]="; cin>>kd;
gotoxy(10,9);
cout<<"jenis bayar[1. tunai/2. kredit]="; cin>>jns;
gotoxy(10,10);
cout<<"-------------------------------\n";
if((kd=='A'||kd=='a')&&(jns==1))
{
nama="televisi";
jenis="tunai";
harga=500000;
}
else if((kd=='A'||kd=='a')&&(jns==2))
{
nama="televisi";
jenis="kredit";
harga=650000;
}
else if((kd=='B'||kd=='b')&&(jns==1))
{
nama="kipas angin";
jenis="tunai";
harga=150000;
}
else if((kd=='B'||kd=='b')&&(jns==2))
{
nama="kipas angin";
jenis="kredit";
harga=250000;
}
else if((kd=='C'||kd=='c')&&(jns==1))
{
nama="VCD";
jenis="tunai";
harga=300000;
}
else if((kd=='C'||kd=='c')&&(jns==2))
{
nama="VCD";
jenis="kredit";
harga=450000;
}
else
{
nama="_";
jenis="_";
harga=0;
}
gotoxy(10,11);
cout<<"Nama barang="<gotoxy(10,12);
cout<<"jenis bayar="<gotoxy(10,13);
cout<<"harga barang="<gotoxy(10,14);
cout<<"jumlah beli="; cin>> jumlah;
total=harga*jumlah;
gotoxy(10,15);
cout<<"total bayar="<gotoxy(10,16);
cout<<"--------------------";
gotoxy(10,17);
cout<<"masih mau beli barang lagi[y/t]="; cin>>lagi;
clrscr();
}
}

No Response to "Tugas Ke 4 Program C++ Hasil Penjualan Barang/Produk"

Posting Komentar