C语言二维链表

Python018

C语言二维链表,第1张

typedef struct list {//............struct list *next}*Listint a[N][M],iList *p = (List *)malloc(N * sizeof(list))for(i = 0i <N++i) {p[i] = (List)malloc(sizeof(list)) CreateList(p[i],a[i],M)// 用a[i]创建p[i]}

 const int  a[2][100]={{1000,1900,2100,。。。},{500,530,560,。。。}};

 const long c[2][100]={{1000*500,},{1,2,00}}

 int Chazhao(int d[2][100],int b,char h)

 {

 int i;

 for(i=0i<100i++)

 {

   if(d[h&0x01][i]==b)

    break    

  }

  if(i!=100)

  return(d[~h&0x01][i])

  else

  return(0)         // 返回没有查到的代码;

  }

 //使用:已知 e:转速1900

 int e =1900;

 f = Chazhao(a,e,0)   //  f定义查找得到的负载

 if(f)               //  判断是否查到。

 g = Chazhao(c,f*e,0) //  g定义根据转速和负载求数据。

 //  定义个三维数组就行,表格根据数而定,h 定义为是根据什么查什么的。即根据转速查负载为0,根据负载查转速为1,的bit变量,只有最后一位而定,C就是根据负载和转速组合成的第三个值。

int 数组[3] = { 0, 1, 2 }

int 二维数组[2][2] = { { 1, 2 }, { 3, 4 } }

cout <<二维数组[0][0] <<endl

<<二维数组[0][1] <<endl

<<二维数组[1][0] <<endl

<<二维数组[1][1] <<endl