#include <iomanip.h>
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
fungsi1()
{
cout<<"------------------------------------------------------------"<<endl;
cout<<" KODE : JUDUL : JUMLAH EPISODE"<<endl;
cout<<"------------------------------------------------------------"<<endl;
cout<<" AN01 Another 12"<<endl;
cout<<" BB01 Black Butler 24"<<endl;
cout<<" RM01 Rozen Maiden 12"<<endl;
cout<<"------------------------------------------------------------"<<endl;
}
fungsi2()
{
cout<<"------------------------------------------------------------"<<endl;
cout<<"NO : NAMA : JUDUL : EPISODE : JML BELI : BONUS"<<endl;
cout<<"------------------------------------------------------------"<<endl;
}
void main()
{
int i, j;
struct
{
char kode[5];
char nama[5];
char judul[20];
char bonus[5];
int episode;
int jumlah;
}anime[6];
clrscr();
fungsi1();
cout<<"MASUKAN JUMLAH DATA : ";cin>>j;
for(i=1;i<=j;i++)
{
cout<<"DATA KE - "<<i<<endl;
cout<<"NAMA : ";cin>>anime[i].nama;
cout<<"KODE ANIME : ";cin>>anime[i].kode;
if(strcmpi(anime[i].kode, "AN01")==0)
{
strcpy(anime[i].judul, "Another");
anime[i].episode=12;
}
else if(strcmpi(anime[i].kode, "BB01")==0)
{
strcpy(anime[i].judul, "Black Butler");
anime[i].episode=24;
}
else if(strcmpi(anime[i].kode, "RM01")==0)
{
strcpy(anime[i].judul, "Rozen Maiden");
anime[i].episode=12;
}
else
{
strcpy(anime[i].judul, "ERROR");
anime[i].episode=0;
}
cout<<"JUMLAH BELI : ";cin>>anime[i].jumlah;
if(anime[i].jumlah>10)
strcpy(anime[i].bonus, "DVD");
else if(anime[i].jumlah>5)
strcpy(anime[i].bonus, "KAOS");
else
strcpy(anime[i].bonus, "STICKER");
}
clrscr();
fungsi2();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(7)<<anime[i].nama;
cout<<setw(20)<<anime[i].judul;
cout<<setw(10)<<anime[i].episode;
cout<<setw(9)<<anime[i].jumlah;
cout<<setw(7)<<anime[i].bonus;
cout<<endl;
}
cout<<"------------------------------------------------------------"<<endl;
getch();
}
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
fungsi1()
{
cout<<"------------------------------------------------------------"<<endl;
cout<<" KODE : JUDUL : JUMLAH EPISODE"<<endl;
cout<<"------------------------------------------------------------"<<endl;
cout<<" AN01 Another 12"<<endl;
cout<<" BB01 Black Butler 24"<<endl;
cout<<" RM01 Rozen Maiden 12"<<endl;
cout<<"------------------------------------------------------------"<<endl;
}
fungsi2()
{
cout<<"------------------------------------------------------------"<<endl;
cout<<"NO : NAMA : JUDUL : EPISODE : JML BELI : BONUS"<<endl;
cout<<"------------------------------------------------------------"<<endl;
}
void main()
{
int i, j;
struct
{
char kode[5];
char nama[5];
char judul[20];
char bonus[5];
int episode;
int jumlah;
}anime[6];
clrscr();
fungsi1();
cout<<"MASUKAN JUMLAH DATA : ";cin>>j;
for(i=1;i<=j;i++)
{
cout<<"DATA KE - "<<i<<endl;
cout<<"NAMA : ";cin>>anime[i].nama;
cout<<"KODE ANIME : ";cin>>anime[i].kode;
if(strcmpi(anime[i].kode, "AN01")==0)
{
strcpy(anime[i].judul, "Another");
anime[i].episode=12;
}
else if(strcmpi(anime[i].kode, "BB01")==0)
{
strcpy(anime[i].judul, "Black Butler");
anime[i].episode=24;
}
else if(strcmpi(anime[i].kode, "RM01")==0)
{
strcpy(anime[i].judul, "Rozen Maiden");
anime[i].episode=12;
}
else
{
strcpy(anime[i].judul, "ERROR");
anime[i].episode=0;
}
cout<<"JUMLAH BELI : ";cin>>anime[i].jumlah;
if(anime[i].jumlah>10)
strcpy(anime[i].bonus, "DVD");
else if(anime[i].jumlah>5)
strcpy(anime[i].bonus, "KAOS");
else
strcpy(anime[i].bonus, "STICKER");
}
clrscr();
fungsi2();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(7)<<anime[i].nama;
cout<<setw(20)<<anime[i].judul;
cout<<setw(10)<<anime[i].episode;
cout<<setw(9)<<anime[i].jumlah;
cout<<setw(7)<<anime[i].bonus;
cout<<endl;
}
cout<<"------------------------------------------------------------"<<endl;
getch();
}