65,211
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <algorithm>
#include <cmath>
#include <time.h>
using namespace std;
int main()
{
clock_t start,finish;
start=clock();
unsigned int s;
for(unsigned int a=0;a<=10000000;a++) //问题主要在这里
{
s = sin(a) + cos(a);
}
finish=clock();
cout<<((double)(finish-start)/CLOCKS_PER_SEC)<<'\n';
start=clock();
int s0;
for(int a0=0;a0<=10000000;a0++) //问题主要在这里
{
s0 = sin(a0) + cos(a0);
}
finish=clock();
cout<<((double)(finish-start)/CLOCKS_PER_SEC)<<'\n';
return 0;
}
double sin(double x);