manage_unmanage


	#ifdef CLR
	#using <mscorlib.dll>
		using namespace System;
	#endif
	#include <time.h>
	#include <stdio.h>
	#include <stdlib.h>
	//#include <sys/types.h>
	//#include <sys/timeb.h>
	//#include <string.h>
	void setNow(char buf[]) {
		_strtime(buf);
	}
	long factorial(int i) {
		//TODO if(i < 1) throw Exception;
		if(i == 1) return 1;
		else return i * factorial(i - 1);
	}
	void printMode() {
	#ifdef CLR
		Console::WriteLine(S"Hello world...by managed");
	#else
		printf ("Hello world...by unmanaged\n");	
	#endif
	}
	void main(int argc, char* argv[]) {
		char startTime[128], endTime[128];
		_tzset();
		setNow(startTime);
		int max=atoi(argv[1]);
		printf("max = %d \n",max);
		unsigned long f;
		for(int i=1; i<max; i++) {
			f = factorial(i);
			printf("factorial %d = %ld \n",i,f);
			for(long j=0; j<f; j++) {
				int k = f % 7;
			}
		}
		setNow(endTime);
		printMode();
		printf("start time:\t\t\t\t%s\n", startTime);
		printf("end time:\t\t\t\t%s\n", endTime);
	}