All pastes #175884 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2006-09-19 06:17 UTC
rendered paste body
#include <iostream>#include	<stdio.h>#include	<time.h>long mult(int value1, int value2){	long product=0;	int i;	for (i=0; i<16; i++)	{		if (value2 & 1)			product += value1;		value1 <<= 1;		value2 >>= 1;	}	return(product);}int main(){	while (true)	{	clock_t start, finish;	int value1=1000, value2=4096;	int i,j,n;	extern long mult(int,int);	printf("Please input repeat count: ");	scanf("%d", &n);	start = clock();	for(j=0; j<n; j++)		for (i=0; i<1000000; i++)			mult(value1, value2); 	finish = clock();	printf("Multiplication took %f seconds to finish.\n", ((double)(finish-start)) / CLOCKS_PER_SEC);		}	system("PAUSE");	return 0;}