⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lee.cpp

📁 Vc++Romberg的
💻 CPP
字号:
#include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }



 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }


 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }


 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }




 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }


 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }


 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }


 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }


 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }

 #include<iostream.h>
#include<malloc.h>
#include<conio.h>
#define ok 0
typedef struct Node{
int data;
struct Node *prior;
struct Node *next;  }Node,*List;
InitList(Node &L)
{ L.data=(int)malloc(sizeof(Node));
  if(!L.data)  return ok;
  L.data=9;
  L.prior=L.next=NULL;
  return  ok;
  }
Insert(Node *L,int e)
{ Node *s,*p;  InitList(*L);
  s->data=(int)malloc(sizeof(Node));
  if(!s->data)   return ok;
  s->data=e;
  s->prior=p->prior;   p->prior->next=s;
  s->next=p;   p->prior=s;
  return ok;
}
Get(Node *L,int i)
{ Node *p; int j;
  p=L->next; j=0;
  while(p&&j<i) { p=p->next; ++j; }
  if(!p||j>i) return 0;
  e=p->data;
  return e;
}
main()
 { Node *L;
   int a=0;
  InitList(*L);
  a=Get(L,0,9);
  cout<<a<<endl;
  return 0;
 }


 double TTools::Romberg( double( *f )( double ) , double a , double b , double e )
{
  int m = 1 , k = 1 , j ; 
  double T[ 100 ] , h = b - a , temp , T1 , Tj , s ;

  T[ 1 ] = h * ( f( a ) + f( b ) ) / 2 ;
  while( ++k ){
    m *= 2 ; h /= 2 ;temp = 0 ;
    for( j = 1 ; j <= m / 2 ; ++j ){
      temp += f( a + ( 2 * j - 1 ) * h ) ;
    }
    T1 = ( T[ 1 ] + 2 * h * temp ) / 2 ;
    s = 1 ;
    for( j = 2 ; j <= k ; ++j ){
      s *= 4 ;
      Tj = T1 + ( T1 - T[ j - 1 ] ) / ( s - 1 ) ;
      temp = Tj - T1 ? Tj - T1 : T1 - Tj ;
      if( temp < e ){
        return Tj ;
      }
      T[ j - 1 ] = T1 ; T1 = Tj ;
    }
  }
}




double TTools::Romberg( double( *f )( double ) , double a , double b , double e )
{
  int m = 1 , k = 1 , j ; 
  double T[ 100 ] , h = b - a , temp , T1 , Tj , s ;

  T[ 1 ] = h * ( f( a ) + f( b ) ) / 2 ;
  while( ++k ){
    m *= 2 ; h /= 2 ;temp = 0 ;
    for( j = 1 ; j <= m / 2 ; ++j ){
      temp += f( a + ( 2 * j - 1 ) * h ) ;
    }
    T1 = ( T[ 1 ] + 2 * h * temp ) / 2 ;
    s = 1 ;
    for( j = 2 ; j <= k ; ++j ){
      s *= 4 ;
      Tj = T1 + ( T1 - T[ j - 1 ] ) / ( s - 1 ) ;
      temp = Tj - T1 ? Tj - T1 : T1 - Tj ;
      if( temp < e ){
        return Tj ;
      }
      T[ j - 1 ] = T1 ; T1 = Tj ;
    }
  }
}




double TTools::Romberg( double( *f )( double ) , double a , double b , double e )
{
  int m = 1 , k = 1 , j ; 
  double T[ 100 ] , h = b - a , temp , T1 , Tj , s ;

  T[ 1 ] = h * ( f( a ) + f( b ) ) / 2 ;
  while( ++k ){
    m *= 2 ; h /= 2 ;temp = 0 ;
    for( j = 1 ; j <= m / 2 ; ++j ){
      temp += f( a + ( 2 * j - 1 ) * h ) ;
    }
    T1 = ( T[ 1 ] + 2 * h * temp ) / 2 ;
    s = 1 ;
    for( j = 2 ; j <= k ; ++j ){
      s *= 4 ;
      Tj = T1 + ( T1 - T[ j - 1 ] ) / ( s - 1 ) ;
      temp = Tj - T1 ? Tj - T1 : T1 - Tj ;
      if( temp < e ){
        return Tj ;
      }
      T[ j - 1 ] = T1 ; T1 = Tj ;
    }
  }
}







数值算法] 合计2035个 | 首页  上一页  下一页  尾页  页次:35/103页 20个/页    第页 
 
 hconv.zip 2004-12-6 3KB 3 
·16进制与10进制转化程序..  
 开发工具:C 提供者:gao 
 
 postorder.rar 2004-12-5 1KB 0 
·基于后序遍历的实现..  
 开发工具:VC 提供者:郑庆宁 
 
 huffcoder.rar 2004-12-5 1KB 7 
·基于哈夫曼编码的实现..  
 开发工具:VC 提供者:郑庆宁 
 
 shell sort.rar 2004-12-5 1KB 1 
·用希尔算法实现的排序..  
 开发工具:VC 提供者:郑庆宁 
 
 tree sort.rar 2004-12-5 1KB 1 
·用二叉树算法实现的排序..  
 开发工具:VC 





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































⌨️ 快捷键说明

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