Advertisement
c4tf1sh

INTL.h

Oct 22nd, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.70 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <iostream.h>
  4. #include <sstream.h>
  5.  
  6. #define len 4
  7.  
  8. namespace intl
  9. {
  10.     const int max_size = 1028;
  11.     template <class D>
  12.         D readln();
  13.     template <class D>
  14.         void writeln( D data );
  15.  
  16.     struct INTL
  17.     {
  18.         int     osn;
  19.         int     digits[max_size];
  20.         int     size;
  21.         bool    negative;
  22.  
  23.         INTL();
  24.         INTL( string number );
  25.         INTL( long number );
  26.  
  27.         void    setmemory( string number );
  28.         int     getlenght();
  29.         void    input();
  30.         void    output();
  31.         void    Shift( int pos, int digit );
  32.     };
  33.  
  34.     string  int2str( long number );
  35.     long    str2int( string number );
  36.     INTL    int2intl( long number );
  37.     long    intl2int( INTL ln );
  38.  
  39.     namespace operators
  40.     {
  41.         void operator << ( const ostream &, INTL &z );
  42.         void operator >> ( const istream &, INTL &z );
  43.  
  44.         INTL operator + ( const INTL &a, const INTL &b );
  45.         INTL operator - ( const INTL &a, const INTL &b );
  46.         INTL operator * ( const INTL &a, const INTL &b );
  47.         INTL operator / ( const INTL &a, const INTL &b );
  48.         INTL operator % ( const INTL &a, const INTL &b );
  49.  
  50.         void operator ++ ( INTL &a );
  51.         void operator += ( INTL &a, const INTL &b );
  52.         void operator -- ( INTL &a );
  53.         void operator -= ( INTL &a, const INTL &b );
  54.         void operator *= ( INTL &a, const INTL &b );
  55.         void operator /= ( INTL &a, const INTL &b );
  56.         void operator %= ( INTL &a, const INTL &b );
  57.  
  58.         bool operator < (const INTL &a, const INTL &b);
  59.         bool operator > (const INTL &a, const INTL &b);
  60.         bool operator <= ( const INTL &a, const INTL &b );
  61.         bool operator >= ( const INTL &a, const INTL &b );
  62.         bool operator == ( const INTL &a, const INTL &b );
  63.     }
  64.  
  65.     INTL pow( const INTL &a, const int &N );
  66.     INTL sqrt( INTL rslt );
  67.     INTL factorial( INTL n );
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement