All pastes #740397 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-17 21:59 UTC
rendered paste body
#include <iostream>
#include <iomanip>
#include <boost/thread/thread.hpp>

class FB
{
	public:
		void inite()
		{
			FB fb;
			boost::thread th1( this->Th1Proc);
			boost::thread th2( Th2Proc);
 
			th2.join();
			th1.join();
		}
 
		static unsigned long run(register unsigned long number)
		{
			if ( (number==0) or (number==1) )
			{
				return number;
			}
			else
			{
				return run(number-1) + run(number-2);
			}
		}
 
		static void Th1Proc()
		{
			register unsigned short i;
			for(i=0; i<42; i++)
			{
				if((i%2) == 0)
				{
					std::cout << "THREAD_0::FIBO(" << std::setw(4) << i <<    ") = " 
							<< std::setw(10) << run(i) << std::endl;
				}
			}
		}
 
		static void Th2Proc()
		{
			register unsigned short i;
			for(i=0; i<42; i++)
			{
				if((i%2) == 1)
				{
					std::cout   << "THREAD_1::FIBO(" << std::setw(4) << i << ") ==> " 
							<< std::setw(10) << run(i) << std::endl;
				}
			}
		}
};
 
 
int main()
{
	FB dd;
	dd.inite();
	return 0;
}