P
Protoman
I'm trying to print a complex number and i get this as output: Phi:
(1.618034,0.000000).
What does it mean? How do I get it to print normally? Here's the code:
----------fib.hpp-------------
#ifndef FIB_HPP
#define FIB_HPP
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <complex>
using namespace std;
namespace
{
template <long N>
class Fib
{
public:
static const long double val=Fib<N-2>::val+Fib<N-1>::val;
};
template<>
class Fib<2>
{
public:
static const long double val=1;
};
template<>
class Fib<1>
{
public:
static const long double val=1;
};
const complex<long double> phi= Fib<32>::val/Fib<31>::val;
}
#endif
--------------------------
------Main.cpp------
#include "fib.hpp"
int main()
{
cout << "Phi: " << fixed << phi << endl;
system("PAUSE");
return 0;
}
(1.618034,0.000000).
What does it mean? How do I get it to print normally? Here's the code:
----------fib.hpp-------------
#ifndef FIB_HPP
#define FIB_HPP
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <complex>
using namespace std;
namespace
{
template <long N>
class Fib
{
public:
static const long double val=Fib<N-2>::val+Fib<N-1>::val;
};
template<>
class Fib<2>
{
public:
static const long double val=1;
};
template<>
class Fib<1>
{
public:
static const long double val=1;
};
const complex<long double> phi= Fib<32>::val/Fib<31>::val;
}
#endif
--------------------------
------Main.cpp------
#include "fib.hpp"
int main()
{
cout << "Phi: " << fixed << phi << endl;
system("PAUSE");
return 0;
}