#include <iostream>
#include <windows.h>
using namespace std;
int main(int argc, char* argv[])
{
DWORD start, end;
start = GetTickCount();
for(int i=0;i<1000;i++)
cout<<"you are a good child!"<<endl; //your code
end = GetTickCount()-start;
cout<<end<<endl;
return 0;
}
#include <stdio.h>
#include <string.h>
#include "time.h"
int main()
{
int nch=0, ndata=0, nsp=0, other=0;
int i,n;
char a[1111];
clock_t start,finish;
double duration;
gets(a);
n=strlen(a);
start=clock();
for(i=0;i<n;i++)
{
if((a[i]>='A'&&a[i]<='Z')||(a[i]>='a'&&a[i]<='z'))
nch++;
else if(a[i]>='0'&&a[i]<='9')
ndata++;
else if(a[i]==' ')
nsp++;
else
other++;
}
finish=clock();
duration = (double)(finish-start)/CLOCKS_PER_SEC;
printf("%fseconds.\n",duration);
printf("nch=%d,ndata=%d,nsp=%d,other=%d",nch,ndata,nsp,other);
return 0;
}