answersLogoWhite

0


Best Answer

With unstructured programming, statements are written on numbered lines, with one statement per line. The statements are executed in numerical order until we encounter a goto statement which passes control to a given line number. For instance, a simple if statement might be implemented as follows:

1 let x = random

2 if (x=0) goto 4

3 x = x * 2

4 print x

In the above example, line 3 is executed unless x is 0. Short forward jumps like this are reasonably easy to read, however a goto can jump forwards or backwards any number of lines and code that jumps backwards and forwards too much soon becomes "spaghetti code". We might have several jumps to the same point, so we quickly lose track of where we jumped from and it soon becomes difficult to keep track of all the variables.

Structured programming makes use of control structures with one entry and one exit point. The three most important control structures are sequence, selection and repetition. A sequence is a conventional procedure, with one statement leading to the next. Selection makes use of the if control structure, allowing us to execute or ignore the following sequence depending on the result of a predicate. An if structure may also have an else clause, thus allowing selection between two sequences, only one of which will execute. The second sequence (the else clause) may be another if structure (a nested if), thus allowing more complex selections to be made. Finally, repetition allows us to loop through a sequence for as long as a predicate holds true. The predicate may be evaluated at the start of each iteration (before entering the sequence) or at the end of each iteration (after exiting the sequence), but never both. However, we can also use selections within the loop itself, such that we may choose to start a new iteration (assuming the predicate holds true) or to break out of the loop entirely (regardless of the predicate).

User Avatar

Mac O'Connell

Lvl 10
1y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between structure and unstructured programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Short note on structural programming and procedural programming?

There is no difference between procedural programing language & structure programing language.


What is the difference between a structured and unstructured questionnaire?

ghant


How decision support system may help cope with the growth in unstructured data and unstructured decisions?

discuss the difference between structured and unstructured problems.


Is there any difference between programming structures and having a structured program?

In a structured program, any structure can be nested within another structure.


What is the difference between structured and unstructured problem?

,knknnknnkn .,mk;lm;lm bhfctydxftxfx yhvccc


Difference between conventional programming and object oriented programming?

diff between oops and conventional programming


What is the difference between java and object oriented programming?

java is a programming language/platform that embodies object oriented programming concepts. The question of what is the difference is like asking what is the difference between cars and a Volvo.


Difference between C and C programming language?

The C and C programming languages are one and the same. There is no difference between those languages.


What is the difference between structured oriented programming procedure and oriented programming?

LOTTA


What is the difference between allocation and search data structure?

difference between serch data structure and allocation data structure


Difference between tall and flat organization structure?

There does not have to be a difference between a tall organization structure and a flat organization structure. These structures can be the same structure.


What is the difference structured programming language and java?

There is no difference between procedural programing language & structure programing language