// DNALink.cpp : Defines the entry point for the console application.
/************************************************************************/
/*                             双向链表的应用                                                       */
/************************************************************************/
#include "stdafx.h"
enum{NO,YES};
typedef struct Node
{
 char nucleotide;
 struct Node *next;
 struct Node *prev;
}DNA;
typedef struct DNANode
{
 DNA *strand1;
 DNA *strand2;
}DNAlist;
/************************************************************************/
/*                           两个单DNA混合为一个DNA链                                      */
/************************************************************************/
DNAlist *Hybridize(DNA *dna1,DNA *dna2)
{
 DNA *temp1=dna1;
 DNA *temp2=dna2;
 DNAlist *dnalist;
 int WC_Compatibe=NO;
 for (;temp1!=NULL;temp1=temp1->next,temp2=temp2->next)
 {
  if((temp1->nucleotide=='A'&&temp2->nucleotide=='T')||(temp1->nucleotide=='G'&&temp2->nucleotide=='C')
    ||(temp1->nucleotide='T'&&temp2->nucleotide=='A')||(temp1->nucleotide=='C'&&temp2->nucleotide=='G'))
  {
   WC_Compatibe=YES;
  }
  else
  {
   WC_Compatibe=NO;
   break;
  }
 
  if(WC_Compatibe==YES)
  {
   dnalist->strand1=temp1;
   dnalist->strand2=temp2;
  }
  else
  {
     dnalist->strand1=NULL;
     dnalist->strand2=NULL;
  }
  return dnalist;
}
/************************************************************************/
/*                       返回溶合后的DNA                                                         */
/************************************************************************/
DNA **Melt(DNAlist *dnalist)
{
 DNA *temp[2];
 temp[0]=dnalist->strand1;
 temp[1]=dnalist->strand2;
 return temp;
}
int _tmain(int argc, _TCHAR* argv[])
{
 return 0;
}