pair.hxx

来自「不错的国外的有限元程序代码,附带详细的manual,可以节省很多的底层工作.」· HXX 代码 · 共 43 行

HXX
43 行
字号
//   ******************
//   *** CLASS PAIR ***
//   ******************


#include <stdio.h>

class Pair
/* 
   This class implements key/value associations, e.g., the key 'E' and its
   value 210000. A pair is used as an entry in a dictionary.
 DESCRIPTION :
   A pair has three components : its name (a character), its value (a number),
   a pointer to the next pair in the dictionary.
 TASKS : 
   - Returning its key, or its value, or the next pair ;
   - Appending another pair to itself.
*/
{
   private :
      char    key ;
      double  value ;
      Pair*   next ;

   public :
      Pair (char k,double v)    { key=k ; value=v ; next=NULL ;}
      ~Pair ()                  { }

      void     append (Pair* p) { next = p ;}
      char     giveKey ()       { return key ;}
      Pair*    giveNext ()      { return next ;}
      double&  giveValue()      { return value ;}
      void     printYourself () { printf("   Pair (%c,%f)\n",key,value);}
} ;








⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?