printf 比 cout 效率低
  • 板块学术版
  • 楼主dys0711
  • 当前回复8
  • 已保存回复8
  • 发布时间2024/10/9 21:43
  • 上次更新2024/10/10 08:58:19
查看原帖
printf 比 cout 效率低
1420293
dys0711楼主2024/10/9 21:43

有木有大佬告诉我为什么在这 printf 比 cout 效率低 (printf about 0.7 cout about 0.6 )

#include<bits/stdc++.h>
using namespace std;

int main(){
	int n=1;
	while(n<=10000){
		if(n%2!=0){
			printf("%d",n);
			//cout<<n;
		}
		n++;
	} 
	return 0;
}

感激不尽

2024/10/9 21:43
加载中...