Notice in this program I have not checked whether or not the user actually provided input.
就拿这个程序说事吧,我们根本没有检查,用户到底有没有输入。
Even those of you who've taken AP computer science or something similar perhaps recall that even just getting a piece of input from the user is ridiculously not obvious.
你们中上了AP计算机科学这门课,或者类似的课程的人可能还记得,即使只是从用户那里得到一个输入,也相当麻烦。
I probably whip out a do while loop very rarely, but very often when programming games or any program that takes user input and has to check that user input and yell at the user if they're messing with you or aren't providing what's expected.
我可能很少用do,while,循环,但常常是,当编制程序游戏或需要用户输入的程序是,需要检查用户的输入并提醒用户,如果他们干扰了你,或没有提供所期望的输入。
应用推荐