Posts

Element Count In Array

#include   <iostream #include   <algorithm> #include   <vector> using   namespace   std ; void   Calculate ( int   arr [],  int   size ) {      vector < int >  vect ;      for  ( int   i  =  0 ;  i  <  size ;  i ++)     {          vector < int >:: iterator   iter  =  find ( vect . begin (),  vect . end (),  arr [ i ]);          if  ( iter   ==   vect . end ())         {              vect . push_back ( arr [ i ]);         }     }      for  ( int   i  =  0 ;  i  <  vect . size ();...

Fraction To Decimal

#include   <iostream> #include   <sstream> using   namespace   std ; string   frac_to_deci ( int   num ,  int   den ) {      float   div ;      div  =  float ( num ) /  den ;      stringstream   sso ;      sso   <<   div ;      string   str_div ;      sso   >>   str_div ;      string   final_str ;      for  ( int   i  =  0 ;  i  <  str_div . length ();  i ++)     {          final_str   +=   str_div [ i ] ;          if  ( str_div [ i ]  ==  '.' )         {         ...

Binary Number

  #include   <iostream> #include   <list> #include   <math.h> using   namespace   std ; class   BinaryNumber { public:      list < short >  getBinary ( int );      void   printBinary ( list < short >);      list < short >  onesCompliment ( list < short >);      list < short >  twosCompliment ( list < short >);      list < short >  addBinary ( list < short >,  list < short >); }; template  < typename   T > T   checkInput ( T   input ,  string   content ) {      while  (! cin . good ())     {          cout   <<   " \n Wrong Input, Please Enter It Correctly!! \n " ;      ...

Generalised Linked List

  #include   <iostream> using   namespace   std ; class   Node { public:      bool  Tag;     Node *Next;      union     {          char  Data;         Node *SubList;     }; }; class   GeneralisedLinkedList  :  public   Node { public:     Node *Front, *Tail;      GeneralisedLinkedList ();  // Default Constructer      bool   empty ();      void   push_back ();      void   push_front ();      void   pop_back ();      void   pop_front ();      void   traverse ( Node   * ); }; template  < typename   T > T   c...