引入sys/timeb.h后,timeb can not be resolved

来源:互联网 发布:淘宝天天特价规则 编辑:程序博客网 时间:2024/06/05 20:16
#include <stdio.h>
#include <sys/timeb.h>
int main(void)
{
    struct timeb t1,t2;
    long t;
    double x, sum=1,suml;
    int i,j,n;
    printf("Please input the value of x and n:");
    scanf("%lf,%d",&x, &n);
    ftime(&t1);
    for(i=1;i<=n;i++)
    {
    suml=1;
    for(j=1;j<=i;j++)
    {
    suml=suml*(-1/x);
    }
    sum+=suml;
    }
    ftime(&t2);
    t=(t2.time-t1.time)*1000+(t2.millitm-t1.millitm);
    printf("sum=%lf cost the time %ld",sum,t);
    return 0;
}
0 0