Anda di halaman 1dari 7

ASSENDING

#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include <stdio.h>
menu();
void kotak(int x1,int y1,int x2,int y2);
char jwb,smp;
class dt_suplier{
int kd_suplier;
char nama[30];
char alamat[40];
char kota[20];
int telp;
public:
char kodes;
void isi(void);
void cetak(void);
};
class dt_barang{
int kd_brg;
char nama[30];
char jenis[20];
int satuan;
public:
char kodeb;
void isi(void);
void cetak(void);
};
class dt_transaksi{
int kd_transaksi;
char tanggal[8];
char kd_suplier[10];
char kd_brg[10];
int jumlah;
public:
char kodet;
void isi(void);
void cetak(void);
};
void dt_suplier::isi(void)
{
clrscr();
kotak(20,4,58,17);
gotoxy(21,13);printf("_____________________________________");
gotoxy(28,2);cout<<" Isi Data Suplier";
gotoxy(24,7);cout<<"Kode
:",//cin>>kd_suplier;
gotoxy(24,8);cout<<"Nama
:",//cin>>nama;
gotoxy(24,9);cout<<"Alamat
:",//cin>>alamat;
gotoxy(24,10);cout<<"Kota
:",//cin>>kota;
gotoxy(24,11);cout<<"No Telp
:",//cin>>telp;
gotoxy(43,7);cin>>kd_suplier;
gotoxy(43,8);cin>>nama;
gotoxy(43,9);cin>>alamat;
gotoxy(43,10);cin>>kota;
gotoxy(43,11);cin>>telp;
kodes=kd_suplier;

}
void dt_suplier::cetak(void)
{
int s;
kotak(5,7,65,9);
gotoxy(15,5);printf("
DATA SUPLIER ");
gotoxy(7,8);printf("No Kode Nama
Alamat
Kota
Telp");
gotoxy(6,10+s);printf("
");
gotoxy(6,11+s);printf("------------------------------------------------------------");
{
gotoxy(7,10+s);cout<<(s+1);
gotoxy(12,10+s);cout<<kd_suplier;
gotoxy(20,10+s);cout<<nama;
gotoxy(32,10+s);cout<<alamat;
gotoxy(46,10+s);cout<<kota;
gotoxy(57,10+s);cout<<telp;
}
gotoxy(5,10);printf("%c",179);
gotoxy(65,10);printf("%c",179);
gotoxy(5,11+s);printf("%c",192);
gotoxy(65,11+s);printf("%c",217);
gotoxy(5,10+s);printf("%c",179);
gotoxy(65,10+s);printf("%c",179);
gotoxy(7,12+s);printf("
");
gotoxy(7,13+s);printf(" ENTER !");
}
void dt_barang::isi(void)
{
clrscr();
kotak(20,4,58,17);
gotoxy(21,13);printf("_____________________________________");
gotoxy(28,2);cout<<" Isi Data Barang";
gotoxy(28,7);cout<<"Kode
:",//cin>>kd_brg;
gotoxy(28,8);cout<<"Nama
:",//cin>>nama;
gotoxy(28,9);cout<<"Jenis
:",//cin>>jenis;
gotoxy(28,10);cout<<"Satuan
:";//cin>>satuan;
gotoxy(42,7);cin>>kd_brg;
gotoxy(42,8);cin>>nama;
gotoxy(42,9);cin>>jenis;
gotoxy(42,10);cin>>satuan;
kodeb=kd_brg;
}
void dt_barang::cetak(void)
{
int b;
kotak(5,7,54,9);
gotoxy(15,5);printf("
DATA BARANG ");
gotoxy(7,8);printf("No Kode Nama
Jenis
Satuan ");
gotoxy(6,10+b);printf("
");
gotoxy(6,11+b);printf("-------------------------------------------------");
{
gotoxy(7,10+b);cout<<(b+1);
gotoxy(12,10+b);cout<<kd_brg;
gotoxy(20,10+b);cout<<nama;
gotoxy(32,10+b);cout<<jenis;
gotoxy(46,10+b);cout<<satuan;
}
gotoxy(5,10);printf("%c",179);

gotoxy(54,10);printf("%c",179);
gotoxy(5,11+b);printf("%c",192);
gotoxy(54,11+b);printf("%c",217);
gotoxy(5,10+b);printf("%c",179);
gotoxy(54,10+b);printf("%c",179);
gotoxy(7,12+b);printf(" ENTER !");
}
void dt_transaksi::isi(void)
{
clrscr();
kotak(20,4,58,17);
gotoxy(21,13);printf("_____________________________________");
gotoxy(28,2);cout<<"
Isi Transaksi";
gotoxy(28,6);cout<<"Kode
:",//cin>>kd_transaksi;
gotoxy(28,7);cout<<"Tanggal Transaksi :",//cin>>tanggal;
gotoxy(28,8);cout<<"Kd_Suplier
:",//cin>>kd_suplier;
gotoxy(28,9);cout<<"Kd_Barang
:",//cin>>kd_barang;
gotoxy(28,10);cout<<"Jumlah
:";//cin>>jumlah
gotoxy(48,6);cin>>kd_transaksi;
gotoxy(48,7);cin>>tanggal;
gotoxy(48,8);cin>>kd_suplier;
gotoxy(48,9);cin>>kd_brg;
gotoxy(48,10);cin>>jumlah;
kodet=kd_transaksi;
}
void dt_transaksi::cetak(void)
{
int t;
kotak(5,7,65,9);
gotoxy(15,5);printf("
DATA TRANSAKSI ");
gotoxy(7,8);printf("No Kode Tanggal Kd_Suplier Kd_Barang Jumlah");
gotoxy(6,10+t);printf("
");
gotoxy(6,11+t);printf("------------------------------------------------------------");
{
gotoxy(7,10+t);cout<<(t+1);
gotoxy(12,10+t);cout<<kd_transaksi;
gotoxy(20,10+t);cout<<tanggal;
gotoxy(32,10+t);cout<<kd_suplier;
gotoxy(46,10+t);cout<<kd_brg;
gotoxy(57,10+t);cout<<jumlah;
}
gotoxy(5,10);printf("%c",179);
gotoxy(65,10);printf("%c",179);
gotoxy(5,10+t);printf("%c",179);
gotoxy(65,10+t);printf("%c",179);
gotoxy(5,11+t);printf("%c",192);
gotoxy(65,11+t);printf("%c",217);
gotoxy(6,10+t);printf("");
gotoxy(5,12+t);printf(" ENTER !");
}
void urutsuplier(dt_suplier suplier1[],int jmls)
{
int i,j;
dt_suplier temp;
for (i=0;i<=jmls-1;i++)
{
for(j=0;j<=jmls-2;j++)
{

if (suplier1[j].kodes>suplier1[j+1].kodes)
{
temp=suplier1[j];
suplier1[j]=suplier1[j+1];
suplier1[j+1]=temp;
}
}
}
}
void urutbarang(dt_barang barang[],int jmlb)
{
int i,j;
dt_barang temp;
for (i=0;i<=jmlb-1;i++)
{
for(j=0;j<=jmlb-2;j++)
{
if (barang[j].kodeb>barang[j+1].kodeb)
{
temp=barang[j];
barang[j]=barang[j+1];
barang[j+1]=temp;
}
}
}
}
void uruttransaksi(dt_transaksi transaksi[],int jmlt)
{
int i,j;
dt_transaksi temp;
for (i=0;i<=jmlt-1;i++)
{
for(j=0;j<=jmlt-2;j++)
{
if (transaksi[j].kodet>transaksi[j+1].kodet)
{
temp=transaksi[j];
transaksi[j]=transaksi[j+1];
transaksi[j+1]=temp;
}
}
}
}
main(void)
{
int jmls=0;
int jmlb=0;
int jmlt=0;
dt_suplier suplier1[20];
dt_barang barang[20];
dt_transaksi transaksi[20];
char pilih='0';
while(pilih!='7')
{
menu();
gotoxy(36,15);scanf("%c",&pilih);
switch(pilih)
{

case '1' :
do
{
clrscr();
suplier1[jmls].isi();
gotoxy(22,15);cout<<"Isi Data Lagi [y/t]==> "; cin>>smp;
jmls=jmls+1;
}
while (smp=='Y' || smp=='y');
break;
case '2' :
do
{
clrscr();
barang[jmlb].isi();
gotoxy(22,15);cout<<"Isi Data Lagi [y/t]==> ";cin>>smp;
jmlb=jmlb+1;
}
while (smp=='Y' || smp=='y');
break;
case '3' :
do
{
clrscr();
transaksi[jmlt].isi();
gotoxy(22,15);cout<<"Isi Data Lagi [y/t]==> ";cin>>smp;
jmlt=jmlt+1;
}
while (smp=='Y' || smp=='y');
break;
case '4' :
clrscr();
urutsuplier(suplier1,jmls);
int s;
{
for (s=0;s<jmls;s++)
{
suplier1[s].cetak();
}
getch();
}
break;
case '5' :
clrscr();
urutbarang(barang,jmlb);
int b;
for (b=0;b<jmlb;b++)
{
barang[b].cetak();
}
getch();
break;
case '6' :
clrscr();
uruttransaksi(transaksi,jmlt);
int t;
for (t=0;t<jmlt;t++)
{
transaksi[t].cetak();
}

getch();
break;
case '7':
break;
}
}
return(0);
}
menu()
{
clrscr();
kotak(20,4,58,17);
gotoxy(20,2);printf ("
M E N U
");
gotoxy(28,6);printf("[ 1 ] ISI DATA SUPLIER");
gotoxy(28,7);printf("[ 2 ] ISI DATA BARANG");
gotoxy(28,8);printf("[ 3 ] ISI TRANSAKSI");
gotoxy(28,9);printf("[ 4 ] CETAK DATA SUPLIER");
gotoxy(28,10);printf("[ 5 ] CETAK DATA BARANG");
gotoxy(28,11);printf("[ 6 ] CETAK TRANSAKSI");
gotoxy(28,12);printf("[ 7 ] SELESAI");
gotoxy(21,13);printf("_____________________________________");
gotoxy(23,15);printf(" Pilihan = [ ]");
return 0;
}
void kotak(int x1,int y1,int x2,int y2)
{
int j;
gotoxy(x1,y1);printf("%c",218);
gotoxy(x1,y2);printf("%c",192);
gotoxy(x2,y1);printf("%c",191);
gotoxy(x2,y2);printf("%c",217);
for (j=x1+1;j<x2;j++)
{
gotoxy(j,y1);printf("%c",196);
gotoxy(j,y2);printf("%c",196);
}
for (j=y1+1;j<y2;j++)
{
gotoxy(x1,j);printf("%c",179);
gotoxy(x2,j);printf("%c",179);
}
}