贴上代码:
#include <string.h>
#include <iostream>
#include <string>
#include <iostream>
#define MAXSIZE 10000
using namespace std;
#include <time.h>
#include <sys/timeb.h>
int get_time(string r)
{
struct timeb rawtime;
ftime(&rawtime);
static int ms = rawtime.millitm;
static unsigned long s = rawtime.time;
int out_ms = rawtime.millitm - ms;
unsigned long out_s = rawtime.time - s;
if (out_ms < 0)
{
out_ms += 1000;
out_s -= 1;
}
ms = rawtime.millitm;
s = rawtime.time;
int total = 1000*out_s+out_ms;
cout<<r<<": "<<total<<"ms"<<endl;
return total;
}
int main()
{
<span style="white-space:pre"