Mei 28, 2010

membuat table sederhana

#include<iostream.h>
#include<conio.h>
#include<string.h>
/* membuat table sederhana
compiler borland tutbo cpp 3.0 */
class buku{
int jum;
char pengar[30];
char penerb[30];
char jud[80];
public :
void masukan();
void asig(int x,char *a,char *b,char *c){

jum=x;
strcpy(pengar,a);
strcpy(penerb,b);
strcpy(jud,c);

}
void cetak();

}bukuku[3];


int main(){
clrscr();

bukuku[3].masukan();

clrscr();
bukuku[3].cetak();

getch();
return 0;
}

void buku::masukan(){
int z=1,x;
char a[30],b[30],c[80];


for(z =1; z<=3; z++){
cout<<"jumlah hal : ";
cin>>x;

cout<<"pengarang : ";

cin>>a;

cout<<"penerbit : ";

cin>>b;

cout<<"judul : ";

cin>>c;

bukuku[z].asig(x,a,b,c);

cout<<endl;


}


}








void buku::cetak(){


gotoxy(1,4);

cout<<"

"<<endl;

cout<<" DAFTAR BUKU

"<<endl;

cout<<"----------------------------------------------------------------------|"<<endl;

cout<<"| no | jumlah hal | pengarang | penerbit | judul |"<<endl;

cout<<"|_____________________________________________________________________|"<<endl;

cout<<"| | | | | |"<<endl;

cout<<"| | | | | |"<<endl;

cout<<"| | | | | |"<<endl;

cout<<"======================================================================="<<endl;





for(int z =1; z<=3; z++){





gotoxy(2,z+8);

cout<<z;

gotoxy(7,z+8);



cout<<bukuku[z].jum;

gotoxy(23,z+8);



cout<<bukuku[z].pengar;

gotoxy(40,z+8);

cout<<bukuku[z].penerb;

gotoxy(57,z+8);

cout<<bukuku[z].jud;


}

}

hehehe maaf acak acakan,mendingan download disini untuk coding nya :) heu heu

Tidak ada komentar:

Posting Komentar

Powered by Blogger