All pastes #979575 Raw Edit

Untitled

public cpp v1 · immutable
·published 2008-04-10 13:25 UTC
rendered paste body
// -*- mode: c++ -*-// $Id: ackermann.g++,v 1.4 2001/07/15 03:37:00 doug Exp $// http://www.bagley.org/~doug/shootout///** This copy courtesy of http://www.kano.net/javabench///**  inline ack()//**  Added Timer() code#include <iostream>#include <string>#include <cstdlib>#include <ctime>using namespace std;inline int ack(int M, int N) { return (M ? (ack(M-1,N ? ack(M,(N-1)) : 1)) : N+1); }int main(int argc, char *argv[]) {	int n = ((argc == 2) ? atoi(argv[1]) : 1);	clock_t start=clock(); 	cout << "ack(3," << n << "): " << ack(3, n) << endl;    clock_t endt=clock(); 	cout <<"Time: " << double(endt-start)/CLOCKS_PER_SEC * 1000 << " ms\n"; 	return(0);}