1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
#include<string.h>
char kode[5],jl[5][25];
int harga[5],i;
garis()
{
cout<<"=========================================="<<endl;
}
hitung()
{
if(strcmp(kode[i],"AD01")==0)
{
strcpy(jl[i],"Some One Like You");
harga[i]=10000;
}
else if(strcmp(kode[i],"LP02")==0)
{
strcpy(jl[i],"Irridescent");
harga[i]=12500;
}
else if(strcmp(kode[i],"LG03")==0)
{
strcpy(jl[i],"Born This Way");
harga[i]=15000;
}
else
{
strcpy(jl[i],"Start Over");
harga[i]=17500;
}
}
main()
{
char lagi,bo[10];
int jm[5],tot[5],jb=0,jd;
atas:
clrscr();
cout<<"\t\tDownload Musik \"Ting Ting\""<<endl;
garis();
cout<<"Kode Judul Lagu Harga/Download"<<endl;
garis();
cout<<"AD01 Some One Like You Rp 10.000,-"<<endl;
cout<<"LP02 Irridescent Rp 12.500,-"<<endl;
cout<<"LG03 Born This Way Rp 15.000,-"<<endl;
cout<<"BY04 Start Over Rp 17.500,-"<<endl;
garis();
cout<<endl<<endl;
cout<<"Jumlah Data :";cin>>jd;
for(i=1;i<=jd;i++)
{
cout<<"Download no-"<<i<<endl;
cout<<"Kode Lagu\t\t\t:";cin>>kode[i];
cout<<"Jumlah Download\t:";cin>>jm[i];
}
clrscr();
garis();
cout<<"No Judul Harga Jumlah Total"<<endl;
garis();
for(i=1;i<=jd;i++)
{
hitung();
tot[i]=jm[i]*harga[i];
jb=jb+tot[i];
cout<<setiosflags(ios::left)<<setw(6)<<i;
cout<<setiosflags(ios::left)<<setw(6)<<jl[i];
cout<<setprecision(6)<<" "<<setw(4)<<harga[i];
cout<<setprecision(6)<<" "<<setw(4)<<jm[i];
cout<<setprecision(6)<<" "<<setw(4)<<tot[i]<<endl;
}
garis();
cout<<"\t\t\tTotal Harga "<<jb<<endl;
if(jb>=25000)
{
strcpy(bo,"Ringtones");
}
else
{
strcpy(bo,"Wallpaper");
}
cout<<"\t\t\tBonus\t "<<bo<<endl;
cout<<"\tIngin Input Lagi?";cin>>lagi;
if(lagi=='Y'||lagi=='y')
{
goto atas;
}
else
{
cout<<endl<<endl;
cout<<"\t\t...:::TerimaKasih:::..."<<endl;
}
getche();
}
|