作者easterday@bbs.ee.ntu.edu.tw (數牙), 信區: medeng
標題antct.h
時間台大電機 Maxwell BBS (Sun Aug 29 20:52:42 1999)
轉信站: GIBBS!news.mc.ntu!Maxwell
// antct.h
//const int Max_elem=10;
#define Max_elem 30
class ANTCT
{
// protected:
private:
double *ct;
int nmax;
public:
int ROW;
int COL;
int QQQ;
int *vv,*hh,*qq;
ANTCT(int *v,int leng_v=Max_elem,
int *h,int leng_h=Max_elem,
int *q,int leng_q=Max_elem)
{
nmax=leng_v*leng_h;
ROW=leng_h; // ROW~~b
COL=leng_v; // COL~~a
QQQ=leng_q;
ct= new double [nmax];
vv= new int [COL];
hh= new int [ROW];
qq= new int [QQQ];
// we have to init the vv, hh, qq in the constructor;
// if we init it in the init(), the reference points are lost
for (int fv=0; fv<COL; fv++) vv[fv]=v[fv];
for (int fh=0; fh<ROW; fh++) hh[fh]=h[fh];
for (int fq=0; fq<QQQ; fq++) qq[fq]=q[fq];
};
~ANTCT() {delete ct;}
int init() // initiation for ct[]
{ // self-test
cout<<"(ROW,COL)=("<<ROW<<","<<COL<<")"<<"\n";
if ( ROW+COL!=QQQ+1 )
{ cout<<"sick!"; return -1;} //say "I'm sick!"
for (int i=0; i<nmax;i++) ct[i]=0; // initiaition ct[]
return 0; // say "I'm fine"
}
int size() { return nmax;}
int h_step();
int q_step();
int v_step();
virtual void print();
virtual void fp();
/* { for (int j = 0; j < ROW; j++)
{ for (int i=0; i <COL; i++)
cout<<" "<<ct[j*COL+i];
cout<<"\n";
}
};
*/
};
--
※ Origin: 臺大電機 Maxwell 站 ◆ From: h120.s155.ts32.hinet.net