无法解决此问题吗? [英] Can,t solve this help plz?

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

问题描述

反复提示输入一个数字并求和.当总和刚好超过100时,停止提示并在末尾显示总和.用户输入数字时,不得显示总和. (您不需要计数器,但需要某种终止方式 循环).只能使用for循环.

To repeatedly prompt for a number and sum it. When the sum just exceeds 100, stop the prompting and display the sum at the end. You must not display the sum while the user in typing in numbers. (You do not need a counter but you will need some way of terminating the loop). Using the for loop only.

推荐答案

不要让人们在这里做作业.

Do not ask people to do your homework here.

也就是说,这是提示:

的声明包含三个部分- Initializer (初始化器),该部分仅在循环开始时执行一次, condition (条件),该条件在每个循环中运行一次,并在评估为false时退出循环 迭代器,表示继续进行下一个项目的逻辑.当不需要迭代器时,它可以为空.

The for statement has three parts - Initializer that is executed only once when the loop starts, condition that run once on each loop, and will exit the loop when evaluated to false, and iterator that signal the logic to proceed to the next item. When there is no need for iterator, it could be empty.


这篇关于无法解决此问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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