循环队列的存储结构定义_循环的定义

循环队列的存储结构定义

Loops are among the most basic and powerful of programming concepts. A loop in a computer program is an instruction that repeats until a specified condition is reached. In a loop structure, the loop asks a question. If the answer requires action, it is executed. The same question is asked again and again until no further action is required. Each time the question is asked is called an iteration. 

循环是最基本,最强大的编程概念之一。 计算机程序中的循环是一条重复指令,直到达到指定条件为止。 在循环结构中,循环会提出一个问题。 如果答案需要采取措施,则将其执行。 一次又一次询问相同的问题,直到不需要采取进一步的措施为止。 每次提出问题都称为迭代。

A computer programmer who needs to use the same lines of code many times in a program can use a loop to save time.

需要在程序中多次使用同一行代码的计算机程序员可以使用循环来节省时间。

Just about every programming language includes the concept of a loop. High-level programs accommodate several types of loops. C, C++, and C# are all high-level computer programs and have the capacity to use several types of loops.

几乎每种编程语言都包含循环的概念。 高级程序可容纳多种类型的循环。 CC ++C#都是高级计算机程序,并且具有使用几种类型的循环的能力。

循环类型 ( Types of Loops )

  • A for loop is a loop that runs for a preset number of times.

    for循环是运行预设次数的循环。

  • A while loop is a loop that is repeated as long as an expression is true. An expression is a statement that has a value.

    while循环是只要表达式为真就重复的循环。 表达式是具有值的语句。

  • A do while loop or repeat until loop repeats until an expression becomes false.

    do while循环或重复直到循环重复直到表达式变为假为止。

  • An infinite or endless loop is a loop that repeats indefinitely because it has no terminating condition, the exit condition is never met or the loop is instructed to start over from the beginning. Although it is possible for a programmer to intentionally use an infinite loop, they are often mistakes made by new programmers.

    无限循环或无限循环是无限重复的循环,因为它没有终止条件,从不满足退出条件,或者指示循环从头开始。 尽管程序员可能有意使用无限循环,但是它们经常是新程序员犯的错误。

  • A nested loop appears inside any other for, while or do while loop.

    嵌套循环出现在forwhiledo while循环的任何其他循环中。

A goto statement can create a loop by jumping backward to a label, although this is generally discouraged as a bad programming practice. For some complex code, it allows a jump to a common exit point that simplifies the code.

goto语句可以通过跳回标签来创建循环,尽管通常不建议这样做,因为这是一种不良的编程习惯。 对于某些复杂的代码,它允许跳转到简化代码的公共出口点。

循环控制语句 ( Loop Control Statements )

A statement that alters the execution of a loop from its designated sequence is a loop control statement. C#, for example, provides two loop control statements.

从指定的顺序改变循环执行的语句是循环控制语句。 例如,C#提供了两个循环控制语句。

  • A break statement inside a loop terminates the loop immediately.

    循环内的break语句会立即终止循环。

  • A continue statement jumps to the next iteration of the loop, skipping any code in between.

    Continue语句跳转到循环的下一个迭代,跳过两者之间的任何代码。

计算机程序设计的基本结构 ( Basic Structures of Computer Programming )

Loop, selection, and sequence are the three basic structures of computer programming. These three logic structures are used in combination to form algorithms for solving any logic problem. This process is called structured programming.

循环,选择和顺序是计算机编程的三个基本结构。 这三个逻辑结构结合使用以形成用于解决任何逻辑问题的算法。 此过程称为结构化编程。

翻译自: https://www.thoughtco.com/definition-of-loop-958105

循环队列的存储结构定义

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值