#include"iostream"
#include"time.h"
using namespace std;
int cal1(int a, int b)
{
return a + b;
}
inline int cal2(int a, int b)
{
return a + b;
}
int main()
{
int x[1000], y[1000], z[1000];
clock_t t= clock();
for (int i = 0; i < 1000; i++)
for (int j = 0; j < 1000; j++)
for (int k = 0; k < 1000; k++)
z[i] = cal1(x[i], y[i]);
cout << "not use " << (clock() - t) / CLK_TCK << " seconds" << endl;
t = clock();
for (int i = 0; i < 1000; i++)
for (int j = 0; j < 1000; j++)
for (int k = 0; k < 1000; k++)
z[i] = cal2(x[i], y[i]);
cout << " use " << (clock() - t) / CLK_TCK << " seconds" << endl;
system("pause");
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。