void perpus::sotah()
{
clrscr();
char tmp[30];
int it,x,y;
for (x=0;x<no;x++)
{
index[x]=x;
}
for(y=0;y<no;y++)
{
for(x=0;x<no-1;x++)
{
if(btahun[x] > btahun[x+1])
{
it=btahun[x];
btahun[x]=btahun[x+1];
btahun[x+1]=it;
it=index[x];
index[x]=index[x+1];
index[x+1]=it;
}
}
}
cout<<"SORTING BY TAHUN\n"<<endl;
cout<<"ÉÍÍÍÍËÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»"<<endl;
cout<<"º NO º Tahun º Judul º Pengarang º Jumlah Halaman º"<<endl;
cout<<"ÌÍÍÍÍÎÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹"<<endl;
cout<<"º º º º º º"<<endl;
cout<<"º º º º º º"<<endl;
cout<<"º º º º º º"<<endl;
cout<<"º º º º º º"<<endl;
cout<<"º º º º º º"<<endl;
cout<<"ÈÍÍÍÍÊÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ"<<endl;
cout<<"\nInfo : Hasil sorting by tahun ini sudah"<<endl;
cout<<" disimpan berupa file yang bernama"<<endl;
cout<<" sort-tahun.txt ."<<endl;
ofstream ftahun;
ftahun.open("sort-tahun.txt");
ftahun<<"SORTING BY TAHUN"<<endl;
ftahun<<endl;
ftahun<<"-------------------------------------------------------------------"<<endl;
ftahun<<"| NO | Tahun | Judul | Pengarang | Jumlah Halaman |"<<endl;
ftahun<<"-------------------------------------------------------------------"<<endl;
for (x=0;x<no;x++)
{
gotoxy(3,6+x);cout<<x+1;
gotoxy(8,6+x);cout<<tahun[index[x]];
gotoxy(16,6+x);cout<<judul[index[x]];
gotoxy(34,6+x);cout<<peng[index[x]];
gotoxy(57,6+x);cout<<hal[index[x]];
ftahun<<" "<<x+1<<" "<<tahun[index[x]]<<"\t"<<judul[index[x]]<<"\t\t "<<peng[index[x]]<<"\t\t\t"<<hal[index[x]];
ftahun<<endl;
}
ftahun.close();
getch();
}
void perpus::sejud()
{
b:
clrscr();
int x,y,z,t,r;
char cari[30],j;
cout<<"SEARCHING BY JUDUL\n"<<endl;
cout<<"Masukan Judul Buku : ";
cin>>cari;
for(x=0;x<no;x++)
{
t=0;
for (y=0;y<strlen(cari);y++)
{
if (cari[y]==judul[x][y])
{
t=t+1;
if(t==strlen(cari))
{
z=x;
y=strlen(cari);
x=no;
}
}
else y=strlen(cari);
}
}
cout<<"\n";
cout<<"ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»"<<endl;
cout<<"º Hasil Pencarian : º"<<endl;
cout<<"ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹"<<endl;
cout<<"º º"<<endl;
cout<<"º º"<<endl;
cout<<"º º"<<endl;
cout<<"º º"<<endl;
cout<<"ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ"<<endl;
if (t==strlen(cari))
{
gotoxy(4,8);cout<<"Judul Buku : "<<judul[z]<<endl;
gotoxy(4,9);cout<<"Nama Pengarang : "<<peng[z]<<endl;
gotoxy(4,10);cout<<"Jumlah Halaman : "<<hal[z]<<endl;
gotoxy(4,11);cout<<"Tahun : "<<tahun[z]<<endl;
}
else
{
gotoxy(9,10);
cout<<"Judul Tidak Di Temukan !!";
}
gotoxy(1,14);cout<<"Apakah Anda Mau Mencari Buku Lagi [Y/T] ? ";
do
{
j = toupper(getch());
}
while (!((j=='Y') || (j=='T')));
cout<<j<<endl;
if (j == 'Y')
goto b;
getch();
}
Screen Shoot Program