#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);
}
*メニュー
最新の20件
2018-04-17
2012-01-07
2011-12-07
2011-11-03
2011-10-20
2011-10-18
2014-07-13
2013-08-10
2012-01-26
2012-01-25
2012-01-24
2012-01-23
2012-01-21
2012-01-20
2012-01-19
2012-01-17
2012-01-14
2012-01-13
2012-01-09
人気の10件
- counter: 443
- today: 1
- yesterday: 0
- online: 3