小编Zos*_*sia的帖子

是否比快?

正如在主题中,我在学校里学到的是,速度更快,但有人告诉我,虽然速度更快......我必须优化程序,我想写'while',而不是'for',但是......它赢了'慢一点?例如:

for (int i=0; i<x; i++)
{
   cout<<"dcfvgbh"<<endl;
}
Run Code Online (Sandbox Code Playgroud)

我会写:

i=0;
while (i<x)
{
    cout<<"dcfvgbh"<<endl;
    i++;
}
Run Code Online (Sandbox Code Playgroud)

c++ performance

3
推荐指数
3
解决办法
499
查看次数

标签 统计

c++ ×1

performance ×1