Jawaban Lat Strukture array

main()
{
char nptgs[20],nm[20],lagi;
float tb=0;
int i,j;
awal:
clrscr();
gotoxy(17,1);
cout<<"BLINKZ NOKIA CELL"<<endl;
cout<<"Jl. WWW.FAYBLINKZ.TK Telp. (021) 91990468"<<endl;
cout<<"============================================"<<endl;
cout<<" Nama Petugas
: ";cin>>nptgs;
cout<<" Nama Pembeli
: ";cin>>nm;
cout<<" Jumlah data
: ";cin>>j;
for(i=1;i<=j;i++)
{
cout<<" \n Data ke- "<<i<<endl;
cout<<" Kode [N70/N81/N73] : ";cin>>hp[i].kd;
if(strcmp(hp[i].kd,"N70")==0|| strcmp(hp[i].kd,"n70")==0)
{
hp[i].merk="Nokia N70";
hp[i].hrg=800000;
}
Elseif(strcmp(hp[i].kd,"N73")==0|| strcmp(hp[i].kd,"n73")==0)

{
hp[i].merk="Nokia N73";
hp[i].hrg=1200000;
}
else if(strcmp(hp[i].kd,"N81")==0|| strcmp(hp[i].kd,"n81")==0)

{
hp[i].merk="Nokia N81";
hp[i].hrg=1500000;
}
else
{
hp[i].merk="Nokia E63";
hp[i].hrg=1700000;

Created By F@Y

www.fayblinkz.tk

#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
struct
{
char kd[5],*merk;
int hrg,jml,total;
}hp[30];

Jawaban Lat Strukture array
}

cout<<"=================================================="<<endl;
cout<<"No.

Kode

Merk

Harga

Jumlah

Total

"<<endl;

cout<<"
Hp
Handphone
Beli
"<<endl;
cout<<"=================================================="<<endl;

for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(8)<<hp[i].kd;
cout<<setiosflags(ios::left)<<setw(13)<<hp[i].merk;
cout<<setiosflags(ios::left)<<setw(12)<<hp[i].hrg;
cout<<setiosflags(ios::left)<<setw(8)<<hp[i].jml;
cout<<setiosflags(ios::left)<<setw(2)<<hp[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();
}

Created By F@Y

www.fayblinkz.tk

cout<<" Masukan Jumlah Beli : ";cin>>hp[i].jml;
hp[i].total=hp[i].hrg*hp[i].jml;
tb=hp[i].total+tb;
}
clrscr();
gotoxy(23,1);
cout<<"BLINKZ NOKIA CELL"<<endl;
gotoxy(8,2);
cout<<"Jl. WWW.FAYBLINKZ.TK Telp. (021) 91990468"<<endl;
gotoxy(8,3);
cout<<"============================================"<<endl;
cout<<"Nama Petugas :"<<nptgs<<endl;
cout<<"Nama Pembeli :"<<nm<<endl;