Program Class C++ pada Struk Dealer Motor
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
class{
public:
char kd[5],*merk;
int hrg,jml,total;
}motor[30];
main()
{
char nmsales[20],nm[20],lagi;
float tb=0;
int i,j;
awal:
clrscr();
gotoxy(17,1);
cout<<"S&D MOTOR"<<endl;
cout<<"Jl. sunan wawan beneran No. 38 Telp. 021-192.168.8.1"<<endl;
cout<<"=============================================="<<endl;
cout<<" Nama Sales : ";cin>>nmsales;
cout<<" Nama Pembeli : ";cin>>nm;
cout<<" Jumlah data : ";cin>>j;
for(i=1;i<=j;i++)
{
cout<<" \n Data ke- "<<i<<endl;
cout<<" Kode [SPR/VRO/TGR] : ";cin>>motor[i].kd;
if(strcmp(motor[i].kd,"SPR")==0|| strcmp(motor[i].kd,"spr")==0)
{
motor[i].merk="Supra X";
motor[i].hrg=16540000;
}
else if(strcmp(motor[i].kd,"VRO")==0|| strcmp(motor[i].kd,"vro")==0)
{
motor[i].merk="Vario Techno";
motor[i].hrg=15790000;
}
else if(strcmp(motor[i].kd,"TGR")==0|| strcmp(motor[i].kd,"tgr")==0)
{
motor[i].merk="Tiger";
motor[i].hrg=24940000;
}
else
{
cout<<" Anda Salah Memasukkan Kode . . !!!, input Kode[SPR/VRO/TGR] . ."<<endl;
cout<<" Ingin Input Lagi : ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;
else
goto akhir;
}
cout<<" Masukan Jumlah Beli : ";cin>>motor[i].jml;
motor[i].total=motor[i].hrg*motor[i].jml;
tb=motor[i].total+tb;
}
clrscr();
gotoxy(23,1);
cout<<" S&D MOTOR"<<endl;
gotoxy(8,2);
cout<<"Jl. sunan wawan beneran No. 38 Telp. 021-192.168.8.1"<<endl;
gotoxy(8,3);
cout<<"======================================================"<<endl;
cout<<"Nama Sales :"<<nmsales<<endl;
cout<<"Nama Pembeli :"<<nm<<endl;
cout<<"======================================================"<<endl;
cout<<"No. Kode Merk Harga Jumlah Total "<<endl;
cout<<" Motor Motor Beli "<<endl;
cout<<"======================================================"<<endl;
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(6)<<motor[i].kd;
cout<<setiosflags(ios::left)<<setw(12)<<motor[i].merk;
cout<<setiosflags(ios::left)<<setw(14)<<motor[i].hrg;
cout<<setiosflags(ios::left)<<setw(10)<<motor[i].jml;
cout<<setiosflags(ios::left)<<setw(2)<<motor[i].total<<endl;
}
cout<<"======================================================="<<endl;
printf(" Total bayar Rp. %4.0f",tb);
cout<<endl;
cout<<"Mau Input data lagi[Y/T]:";cin>>lagi;
if (lagi=='Y'||lagi=='y')
goto awal;
else
goto akhir;
akhir:
getch();
}
Source: www.gatewan.com
0 Response to "Program Class C++ pada Struk Dealer Motor"
Posting Komentar