nivs

Untitled

Mar 3rd, 2013
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <math.h>
  2.  
  3. class Complex
  4. {
  5. public:
  6.     Complex(double re, double im)
  7.         : _re(re), _im(im)
  8.     {}
  9.     double modulus() const
  10.     {
  11.         return sqrt(_re * _re + _im * _im);
  12.     }
  13. private:
  14.     double _re;
  15.     double _im;
  16. };
  17.  
  18. void bar(int i)
  19. {
  20.     static int counter = 0;
  21.     counter += i;
  22. }
  23.  
  24. namespace Foo
  25. {
  26. namespace Bar
  27. {
  28. void foo(int a, int b)
  29. {
  30.     for (int i = 0; i < a; i++)
  31.     {
  32.         if (i < b)
  33.             bar(i);
  34.         else
  35.         {
  36.             bar(i);
  37.             bar(b);
  38.         }
  39.     }
  40. }
  41. } // namespace Bar
  42. } // namespace Foo
Advertisement
Add Comment
Please, Sign In to add comment