Fungsi Array Dimensi 2 + if + goto
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
#include<iomanip.h>
garis()
{cout<<endl;
cout<<"\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2\2"<<endl;
cout<<endl;}
main()
{
char lagi;
char k_lay[100][100], n_lay[100][100], j_bay[100],n_bay[100][100];
float b_pend[10], b_bul[10], b_adm[10],tobay[10];
int i,j;
a:
clrscr();
cout<<"\t\tFITNESS 'CENTER BODY FIT'"<<endl;
garis();
cout<<"\t\tMasukan Jumlah Data: ";cin>>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<<"Data Ke - :"<<i<<endl;
cout<<"Masukan Kode Layanan [FT/SN/YG]: ";cin>>k_lay[i];
cout<<"Masukan Jenis Bayar: ";cin>>j_bay[i];
if (!strcmp(k_lay[i],"FT")||!strcmp(k_lay[i],"ft"))
{
strcpy(n_lay[i],"Fitnes");
if (j_bay[i]=='C'||j_bay[i]=='c')
{strcpy (n_bay[i],"Cash");
b_adm[i]=0;}
if(j_bay[i]=='K'||j_bay[i]=='k')
{strcpy (n_bay[i],"Kredit");
b_adm[i]=25000;}
{b_pend[i]=30000, b_bul[i]=30000;}
}
else if (!strcmp(k_lay[i],"SN")||!strcmp(k_lay[i],"sn"))
{
strcpy(n_lay[i],"Senam");
if (j_bay[i]=='C'||j_bay[i]=='c')
{strcpy (n_bay[i],"Cash");
b_adm[i]=0;}
if (j_bay[i]=='K'||j_bay[i]=='k')
{strcpy (n_bay[i],"Kredit");
b_adm[i]=25000;}
{b_pend[i]=30000, b_bul[i]=40000;}
}
else if (!strcmp(k_lay[i],"YG")||!strcmp(k_lay[i],"yg"))
{
strcpy(n_lay[i],"Yoga");
if (j_bay[i]=='C'||j_bay[i]=='c')
{strcpy (n_bay[i],"Cash");
b_adm[i]=0;}
if(j_bay[i]=='K'||j_bay[i]=='k')
{strcpy (n_bay[i],"Kredit");
b_adm[i]=25000;}
{b_pend[i]=30000, b_bul[i]=50000;}
}
tobay[i] = b_pend[i]+b_bul[i]+b_adm[i];
}
clrscr();
cout<<"\t\t Bukti Pembayaran"<<endl;
cout<<"\t\tFITNESS 'CENTER BODY FIT'"<<endl;
garis();
cout<<"No. Nama Biaya Biaya Jenis Biaya Total"<<endl;
cout<<" Layanan Pendaftaran Bulanan Bayar Adm Bayar"<<endl;
garis();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(7)<<i;
cout<<setiosflags(ios::left)<<setw(7)<<n_lay[i];
cout<<setprecision(10)<<" "<<b_pend[i];
cout<<setprecision(10)<<" "<<b_bul[i];
cout<<setprecision(10)<<" "<<n_bay[i];
cout<<setprecision(10)<<" "<<b_adm[i];
cout<<setprecision(10)<<" "<<tobay[i]<<endl;
}
garis();
cout<<"Ingin Hitung Kembali [Y/T]: ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto a;
cout<<endl;
cout<<"\t\t\2\2\2\2\2\2\2\2\2\2 Terima Kasih \2\2\2\2\2\2\2\2\2\2"<<endl;
getch();
}
Gambar Hasil Coding C++