?? ttest.cpp
字號:
#include <stdio.h>
#include <time.h>
void TimeTestIndex();
void TimeTestPointer();
int main()
{
time_t tStart, tEnd;
long y;
time (&tStart);
for (y = 0; y < 10000000; ++y)
TimeTestIndex();
time (&tEnd);
printf ("Time elapsed = %ld\n", tEnd - tStart);
time (&tStart);
for (y = 0; y < 10000000; ++y)
TimeTestPointer();
time (&tEnd);
printf ("Time elapsed = %ld\n", tEnd - tStart);
return (0);
}
void TimeTestIndex()
{
char str1[] = "The quick red fox jumps over the "
"lazy dog's back. RY Testing";
char str2[124];
int i = 0;
int j = sizeof (str1);
do
{
str2[i] = str1[i];
} while (i++ < j);
}
void TimeTestPointer()
{
char str1[] = "The quick red fox jumps over the "
"lazy dog's back. RY Testing";
char str2[124];
char *pstr1 = str1;
char *pstr2 = str2;
do
{
*pstr2++ = *pstr1++;
} while (*pstr1);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -