Preview

I deserve to be verified on twitter

Good Essays
Open Document
Open Document
733 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
I deserve to be verified on twitter
 What programming techniques or structures can stop or exit an infinite loop?
Sources found on: http://www.dummies.com/how-to/content/breaking-out-of-an-infinite-loop-in-your-c-languag.html & http://www.ehow.com/how_5697840_stop-infinite-loop.html

Loops are programming devices that specify that a section of a program is to be performed one or more times. Typically they are divided into two categories, "for loops" and "while loops". A "for loop" is executed a set number of times. A "while loop" continues to execute until a predefined condition is met. Creating an infinite loop is a very common occurrence for developers

I. Open the source code in the programming software.

II. Identify the infinite loop in the source code. During an infinite loop a program often does not return output or accept input. Start by looking at the code in the area after the last successful input or output action occurred.

III. Insert a line within the loop structure to determine the value of the variable such as in the following Basic language code: while x < 10 print x / line added to monitor variable/ end while

IV. Execute the code and monitor the value of the variable. Determine why the variable is not reaching the value required to fulfill the conditional statement.

V. Modify the source code to satisfy the loop's condition to exit: while x < 10 print x / line added to monitor variable/ x = x + 1 end while

VI. Execute the source code and confirm that the infinite loop has been resolved.

VII. Remove the line of code added to debug the infinite loop.

--------------------------------------------------------------------------------------------------

When you get into programming loops in the C language, you discover the joys and dreads of endless, or infinite, loops. These loops continue forever because either the programmer forgot to include a way to exit from the loop or the exit condition is just never met. Either way, endless loops are a

You May Also Find These Documents Helpful

  • Satisfactory Essays

    PT1420 Chapter 3 Review

    • 1062 Words
    • 8 Pages

    5. Write a pseudocode statement that declares the variable cost so it can hold real numbers.…

    • 1062 Words
    • 8 Pages
    Satisfactory Essays
  • Good Essays

    Week 1 Lab_ CIS_115

    • 439 Words
    • 2 Pages

    List the inputs, any processes/calculations, and the outputs. Use the same valid variable names you used in Step 1.…

    • 439 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Nt1330 Unit 2 Assignment 1

    • 3740 Words
    • 15 Pages

    1. A while loop will not execute the body of the code if you have your test condition incorrect.…

    • 3740 Words
    • 15 Pages
    Satisfactory Essays
  • Satisfactory Essays

    unit 7 assignment 1

    • 431 Words
    • 2 Pages

    1. Why should you indent the statements in the body of a loop? You visually set them apart from the surrounding code.…

    • 431 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    c) Then a nested IF should test if B15 is equal to the shipping option in D41, and if so, then the value in E41 should be used, otherwise the value in E42 should be used.…

    • 724 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    o Provide a set of test values that will cause each of the branches to be executed.…

    • 349 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Quiz Comp Archi

    • 438 Words
    • 3 Pages

    4) Please describe how the clock works in the digital circuit and what are main concerns on the clock design (performance, power).…

    • 438 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Unit 4 Homework

    • 401 Words
    • 2 Pages

    Not Sure what is going to happen because I wrote that whole program and nothing happen. The Value is passed into the parameter value on this program module though.…

    • 401 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    EAS230Syllabus

    • 1748 Words
    • 8 Pages

    C++ programming: editing, compiling, user I/O, variables (ints, doubles, char, strings, booleans), loops, decisions, functions, pointers, arrays, tables, databases, sorting.…

    • 1748 Words
    • 8 Pages
    Powerful Essays
  • Better Essays

    7) Global variables make debugging difficult because any statement in a program can change its value.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Satisfactory Essays

    This Is a Paper

    • 469 Words
    • 2 Pages

    Provide a set of values that will test the normal operation of this program segment. Defend your choices.…

    • 469 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Lab 3 Student

    • 1264 Words
    • 7 Pages

    Step 4: Write the exact output you would expect from the following line of code if the user of the program enters a name of Nolan Owens and they have taken 20 credits so far. (Reference: Displaying Items, page 40 – 41).…

    • 1264 Words
    • 7 Pages
    Satisfactory Essays
  • Powerful Essays

    It 210

    • 2960 Words
    • 12 Pages

    Although the value of a variable may change during execution of a program, in all our programs so far, a single value has been associated with each variable name at any given time. In this chapter, we will discuss the concept of an array—a collection of variables of the same type and referenced by the same name. We will discuss one-dimensional arrays (lists) at length and focus briefly on twodimensional arrays (tables). You will learn how to set up and use arrays to accomplish various tasks.…

    • 2960 Words
    • 12 Pages
    Powerful Essays
  • Good Essays

    Macro Examples

    • 1120 Words
    • 5 Pages

    7. The If…Then…Else…End If code allows code to be conditionally executed depending on whether a specified logical condition has been met.…

    • 1120 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    Atmel Language

    • 1839 Words
    • 8 Pages

    1. 2. 3. Introduction Installing tools for C programming Using AVR Studio for C programming Creating an AVR Studio project Compiling C code to HEX file Debugging C program using the simulator Downloading and running HEX file on AVR board 2 2 3 3 5 6 8…

    • 1839 Words
    • 8 Pages
    Powerful Essays