/* ===================================================================== *\

Programmer: RiNN
File: DecToBin.C
Class: CS102:98
Date: March 3, 1998

  =======================================================================

\* ===================================================================== */


#include 


struct node {
   int data;
   node *right;
   node *left;
};

int BinToDec(node *tail );
int Depth(stack s);
void init();

typedef node *stack;

stack A;


int main()
{int num; init(A);
 cout << "\tPlease Enter a Binaray Number: "; 
 cin >> num; 

 N = Depth(A);
 return 0;

 num = BinToDec(N);
}



void init(){stack=NULL;}



int BinToDec(node *tail){
 int num = 0;
 while(tail !=NULL)
 {
  num = num + tail->data*N;
  N=2*N;
  tail = tail ->left;
 }
 return num;
} 



int Depth(stack s){
 int count=0;
 while(s!=NULL){
 count ++;
 s = s ->next;
 }
 return count;
}


RiNN
http://www.oocities.org/Tokyo/2790/