#GOBJ204L. GESP 2级客观题|嵌套循环|课堂讲解
GESP 2级客观题|嵌套循环|课堂讲解
GESP 2级客观题|嵌套循环|课堂讲解
考试频率:高频。本卷共 2 题。
- 下面两段C++代码都是用于求1-10的和,其运行结果相同。通常说来,for循环都可以用while循环实现。()
int tnt;
int i;
tnt = 0;
for (i = 1; i < 10 + 1; i++)
tnt += i;
cout << tnt << endl;
int tnt;
int i;
tnt = 0;
i = 1;
while (i <= 10){
tnt += i;
i += 1;
}
cout << tnt << endl;
{{ select(1) }}
- 对
- 错
-
任何一个 while 循环都可以转化为等价的
for循环( )。{{ select(2) }}
- 对
- 错