cin或printf? [英] cin or printf?

查看:61
本文介绍了cin或printf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c/c ++中工作时

while working in c/c++,

1.cin/cout或者2.scanf/printf,

1.cin/cout or 2.scanf/printf ,

两者之一,将减少执行或运行时间.或两者将具有相等的运行时间.

which one of both , will have less execution or run time. OR both will have equal runtime.

我的目标是减少代码的运行时间.

my aim is to reduce the runtime of my code.

推荐答案

押宝控制台IO 功能的相对计时是恕我直言,没有任何实际用途.这是完全不可预测的(取决于环境).控制台输出完全取决于控制台的速度,通常取决于printf/cout的速度.尝试使用本地文件输出而不是控制台输出.

To bet on relative timings of console IO functions is imho without any real use. This is completely unpredictable (depends on environment). Console output depends completely on the speed of the console and usually not on the speed of the printf/cout. Try using local file output instead of console output.

这篇关于cin或printf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆