乘法运算
相同的运算规模,花了2秒钟,和XP、debug模式下效率差不多。不过,VC下可以使用release进行优化,我现在在linux下还不懂得如何优化程序呢。
- #include <stdio.h>
- #include <time.h>
- #include <iostream>
- using namespace std;
- int main()
- {
- time_t start,end;
- struct tm* time_start,* time_end;
- time(&start);
- time_start = localtime(&start);
- printf("start time is: %s/n",asctime(time_start));
- double j=0;
- for (int k=0;k<10;k++)
- for (int i=0;i<100000000;i++)
- {
- j*0.1232345;
- }
- time(&end);
- time_end = localtime(&end);
- printf("end time is: %s/n",asctime(time_end));
- return 0;
- }