# Latihan ARRAY dan FUNGSI

int hitung(int a,int b)
{
return(a*b);
}
int bayar(int x,int y)
{
return(x+y);
}
main()
{
char np[20],*merk[30],kd[30],lagi;
int i,j,hrg[30],jml[30],byr[30],tb=0;
awal:
clrscr();
cout<<" B L I N K Z
E L E K T R O N I K "<<endl;
garis();
cout<<"Masukkan Nama Pembeli
: ";cin>>np;
cout<<"Masukkan Jumlah Data
: ";cin>>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<<endl;
cout<<"Data Ke- "<<i<<endl;
cout<<"Kode AC [N/S/P]
: ";cin>>kd[i];
if(kd[i]=='N'||kd[i]=='n')
{
merk[i]="National";
hrg[i]=2500000;
}
else if(kd[i]=='S'||kd[i]=='s')
{
merk[i]="Samsung";
hrg[i]=1750000;
}
else if(kd[i]=='P'||kd[i]=='p')

Created By F@Y

#include<stdio>
#include<conio>
#include<iostream>
#include<iomanip>
garis()
{
cout<<"============================================"<<endl;
}

Latihan ARRAY dan FUNGSI
{
merk[i]="Panasonic";
hrg[i]=2000000;

cout<<"Anda Salah Input !!!,,Input Kode [N/S/P]"<<endl;

cout<<endl<<endl;
cout<<"Mau Input Data Lagi [Y/T] = ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;
else
goto akhir;
}
cout<<"Merk AC
:
cout<<"Harga AC
:
cout<<"Jumlah Beli
:
byr[i]=hitung(jml[i],hrg[i]);
cout<<"Jumlah Bayar
:
tb=bayar(byr[i],tb);

"<<merk[i]<<endl;
"<<hrg[i]<<endl;
";cin>>jml[i];
"<<byr[i]<<endl;

}
clrscr();
cout<<endl<<endl;
garis();
cout<<endl;
cout<<"Nama Pembeli
: "<<np<<endl<<endl;
garis();
cout<<"No Kode Merk Harga
Jumlah
Jumlah"<<endl;
cout<<"
AC
AC
AC
Beli
Bayar "<<endl;
garis();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(6)<<kd[i];
cout<<setiosflags(ios::left)<<setw(14)<<merk[i];
cout<<setiosflags(ios::left)<<setw(16)<<hrg[i];
cout<<setiosflags(ios::left)<<setw(12)<<jml[i];
cout<<setiosflags(ios::left)<<setw(14)<<byr[i]<<endl;
}
garis();
cout<<"T O T A L
B A Y A R
"<<tb<<endl;
garis();
cout<<"Mau Input Data Lagi [Y/T] = ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;

Created By F@Y

}
else
{

Latihan ARRAY dan FUNGSI
else

K A S I H

Created By F@Y

A T A S

"<<endl;