Home TechnologyProgramming Subscribe to RSS
 

What Are The Three Basic Control Structures?

Answer Question

3 Answers - Sort by: Date | Rating

    In any programming language there are some control structures that are used to change the flow of control as required. Two most commonly used control structure are as:

    1. iterative structures
    2. conditional structures

    Conditional structures consist of some condition statements (like if-else statement in C++). These statements check a condition, and perform an action (e.g., execute some statements or call a function etc.) in the case of true condition an in the case of false statement they perform something else as specified by the programmer.

    Iterative structures are used to iterate one or more statements either for a specified number of times or until a specified condition if fulfilled.

    the most commonly used iterative structures in C++ are for loop , while loop  and  do while loop. these may be semantically different in different languages but generally these are same in semantics.

    for loop is normally called counter loop because it is used to iterate the control for a specified number of times and while loop is called conditional loop.
    The third control structures are 'got' statement which neither checks a condition nor iterates statements.

    The Goto statement when encounters, just transfer the control to the specified location.
    This type of structures are not commonly used today because they don't provide some sense of programming.
    1 0

    Raaga 

    answered 3 years ago

    Thank you for the answer...
    Report
    June_78

    June_78

    commented 5 days ago

      Beginning in the 1960s, a number of researchers began to store program design (planning) and the merits of separating the design process from the actual program coding. such a division of labor is a natural one, just as you have architects who designs buildings and separate construction crews who work from specification to erect them. Many of the proposed ideas of the researchers caught on, and methods have evolved that have made program design more systematic and the programs themselves easier to understand and maintain. These methods usually are grouped together under the term structured programming. Advocates of structured programming have shown that any program can be constructed out of three fundamental control structures; sequence, selection, and looping. A sequence control structure is simply a series of procedures that follow one another. A selection (if-then-else) control structure involves a choice. A loop is an operation that repeats until a certain condition is met. With DOWHILE, a loop is executed as long as a certain condition is true. With DOUNTIL, a loop continues as long as a certain condition is false. The three basic control structures are the major building blocks for structured program flowcharts and pseudo code. Control structure is a pattern for controlling the flow of logic is a computer program. The three control structured are: Looping, DOWHILE, DOUNTIL.
      0 0

      Data 

      answered 3 years ago

        In programming normally the sequence of instruction is no limited to linear. We need to repeat several statements or we need to jump from one part of the program to another part of the program. For this purpose the control structures are used.

        The following are the types of control structures.

        Conditional structure:
        If and Else statement is used in the programming for conditional structures. This statement uses a specific condition check. If this condition is true the code following the If statement will be executed otherwise the Else portion will be executed. The Else part of the If state is optional. The syntax of this condition structure varies language to language.

        Iteration structure:
        Iteration structure or loops are used to repeat the instructions. There are mainly three types of loops available. For Loop, While Loop, do while loop. These loops repeat the instruction until a specific condition is true.


        Jump statements:
        These statements include Break, Continue and Goto instructions. These instruction jumps from one portion of the program to another portion of the program. The function calling can also be included in this category.

        Selective structure:
        Switch statement is called selective structure. In this we provide a number of options and take decision depending upon the choice.
        0 0

        Abadit 

        answered 3 years ago

        Answer Question - Answers are editable for 5 min.

        If you do not Sign-in or Register your answers will be anonymous,

        your answers may also be checked before going online.

        More

           
           

          Ask a Question via Twitter

          Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

          Blurtit Store

          Get T-shirts, hoodies, caps and more at the Blurtit store

          Blurtit International