All pastes #980354 Raw Edit

Someone

public cpp v1 · immutable
·published 2008-04-10 23:17 UTC
rendered paste body
// -*- mode: c++ -*-// $Id: strcat.g++,v 1.4 2001/07/11 02:06:39 doug Exp $// http://www.bagley.org/~doug/shootout/// with help from PeterB//** This copy courtesy of http://www.kano.net/javabench///**  Modified to match the Java benchmark (not pre-allocating, just appending)//**  Added Timer() code#include <ctime>#include <cstdlib>#include <iostream>#include <string>using namespace std;int main(int argc, char *argv[]) {    int i, n = ((argc == 2) ? atoi(argv[1]) : 1);    clock_t start=clock();	string str;    for (i = 0; i < n; i++) {		str += "hello\n";    }    clock_t endt=clock(); 	std::cout <<"Time: " << double(endt-start)/CLOCKS_PER_SEC * 1000 << " ms\n";    return 0;}