cin 与 scanf 测试(未完)

#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
int main()
{
    freopen("dataout.txt","w", stdout);
    int start = clock();
    for(int i = 0; i < 1000000; i++)
    {
        printf("%d", i);
    }
    return 0;
}
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
int main()
{
    freopen("dataout.txt","r", stdin);
    int a;
    int start = clock();
    for(int i = 0; i < 1000000; i++)
    {
        scanf("%d\n", &a);
    }
    printf("%.3lf\n",double(clock()-start)/CLOCKS_PER_SEC);
    return 0;
}
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    freopen("dataout.txt","r", stdin);
    int a;
    int start = clock();
    for(int i = 0; i < 1000000; i++)
    {
        cin >> a;
    }
    printf("%.3lf\n",double(clock()-start)/CLOCKS_PER_SEC);
    return 0;
}
订阅评论
提醒
guest
0 评论
内联反馈
查看所有评论