Featured

    Featured Posts

Structured Sequence Control in Programmig language



Most language provide a set of control statements for expressing the basic control forms of composition, alteration, and iteration.  One important aspect of the statements is that each is a one-in, one-out control statement, meaning that in each statement there is only one entry point to the statement and one exit point from it.  If one of these statements is placed in sequence with some other statements, then the sequence of execution will necessarily proceed from the preceding statement into one-in, one out statement through the statement and out of the following statement.
          The flow of program execution must match the sequence of statements in the program text.  Each one-i,n one-out control statement may include internal branching and looping, but control may leave the statement only through its single exit point.

  (a).  Compound Statements :-> A compound statements is a sequence of statements that may be treated as a single in the construction of larger statements for example :
      begin
      --------------
      -------------- { sequence of statements(1or more)
      --------------
      end.

In C, C++,PERL or Java, it is written simply as { ..... }.
    Within the compound, statements are written in the order in which they are to be executed.  Thus the compound statement inn the basic structure for representing the composition of statements.

#  Conditional statements :-> A conditional statement is one that express alternation of two or more statements, or optional execution of a single statements - where statement means either a single basic statements, a compound statements or another control statement.  The choice of alternative is controlled by a test on some condition, usually written as an expression involving relational and Boolean operations.  The most common forms of conditional statement are the if and case statements -

If statement : The optional execution of a statement is expressed as a single branch if viz
  If condition then statement end if.
whereas a choice between two alternatives uses a two-branch if, namely,
If ( statement condition)
then
      statement
else
     statement
end if.

#  Case Statements :-> If statements are implemented using the usual hardware supported branch and jump instructions.  Case statements are commonly implemented using a jump table to avoid repeated testing of the value of the some variable.
Jump Table :  A Jump table is a vector each of whose components is an unconditional jump instruction.
     If fetch the case no. 1,2,3,4,5,6,7..... and add if the vase add of jump table like
Fiegure :
switch(a)
{
case 1:              If we pass the value of a as 3
----------          A jump table fetch the value as 3 and then add
----------          the offset 3 to the base address of switch
break() ;            i.e jump to let t and then execute the
case 2:              case statement and ultimately will jump
----------          out of the loop.
----------
break() ;
case 3:
----------
----------
break() ;
case 4:
----------
----------
  }
}
 Jump table implementation of case statements.

figure----------


# Iteration Statements :-> Iteration statements provide the basic mechanism for repeated calculations in most programs.  The basic structure of an iteration statement consists of a head and a body.  The head controls the number of times the body will be executed, whereas the body is usually a (compound) statement that provides the action of the statement.
Let us look some typical ones :

1. Simple Repetitions :->
                 The simplest type of iteration statements head specifies that the body is to be executed some fixed number of times.
For example :  perform body k times
This statement causes k to be evaluated and then body of the statement to be executed that many times.

2. Repetition while condition holds :-> 
                   In this form of iteration statement, the expression is re-evaluated each time after the body has been executed and it must have to change the value of variable inside the loop otherwise loop will run infinitely and never terminate.
For example :   While test do body.

3. Repetition while incrementing a counter :->
                    The third alternative form of iteration statement is the statement whose head specifies a variable that serves as a counter or index during the iteration, initial value, final value and increment.
For example :  For I = 1 step 2 until 30 do body.

4. Indefinite repetition :->
                     Where the condition for loop exit are complex and not easily expressible in the usual loop head i.e the loop with no explicit termination
loop
------
exit when condition ;
------
end loop




We can write every iteration with for loops.
->  Simple counter : for ( i =1 ; i<= 10 , i++ ) { body }
-> Infinite loop :- for ( ; ; ) { body }
-> Counter with exit condition : for ( i = 1; i <= 100; && NotEndfile ; i++ ) { body }
Advantage :->   It is easy to debug, understand and verify.
Disadvantage ->
  • Multiple exit points.
  • Do-While do.
  • Exceptional condition.
#  Proper program :- A proper program, is our formal model of a control structure.
  1. Has a single entry arc.
  2. Has a single exit arc.
  3. Has a path from the entry arc to each node and from each node to the exit arc.
A prime program is a proper program that cannot be subdivide into smaller proper programs.
# Function Nodes :-> Represent computation by a program with a single arc coming in and single arc going out and is representing by a square box.

fig

# Decision Nodes :-> Are represented as diamond-shaped boxes with one input arc and two output arcs labeled true and false.

fig--

# Join node :-> Is represented as a point where two arcs flow together to form a single output arc.

fig---

A Composite program is that which is not prime.

Storage Management in Programming Language
Programming Languages Concepts 
Subprogram Sequence Control in Programming language. 
Structured Sequence Control in Programmig language 
Sequence Control with in Statements 
Implicit and Explicit sequence Control 
Difference between C language and C++ language.
INTEGRATED DEVELOPMENT ENVIRONMENT FOR VISUAL BASIC (IDE)
  1. Java threads and Interrupts in Java programming language
  2. Abstract classes and Generic function in Java
  3. Callback functions in Java Programming language
  4. Constructors in programming language
  5. Static components and constants concept in programming language
  6. Data encapsulation in programming language.
  7. Java threads and Interrupts in Java programming language





Post a Comment

www.CodeNirvana.in

www.posthatke.com. Powered by Blogger.

Google+ Followers

Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com