Skip to main content

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Unstructured technique of programming in C language

Definition : An approach of designing a program simply using series of statements is called unstructured programming.
In such programming technique every task is solved using series of simple statements only. Branching and repetitions are achieved through a 'goto; statement. Jumping to and out of a block of statements is achieved through 'goto' statement. So, a technique using 'goto' statement is called unstructured technique of programming.

Example:
Problem: Design a program to find factorial of a number
The program required is to find n!=1*2*3*4.....*(n-1)*n. If negative number is entered a proper message is to be displayed. So, the repetition and branching is achieved in unstructured programming technique using 'goto' statement. The statement 'goto' in C is used to take the control from one point to another irrespective of the location of transfer. It takes control to the specified label.

#include<stdio.h>
main( )
{
int n;
unsigned long int fact =1;
ReadAgain:     /* first label to transfer the control */
printf("Enter a number:");
scanf("%d", &n);
if(n<0)
{
printf("Negative number \n");
goto ReadAgain;    /* Control transferred */
}

Repeat:      /* second label to transfer the control  */
fact = fact*n;
n--;
if(n>=1) goto Repeat;  /* Control transferred to label Repeat */
printf(" The factorial is %lu", fact);
}

Features of unstructured technique

  • Simple statements are used to solve a task.
  • The statements used are basic and understandable.
  • This type of programming is called liner programming.
  • The approach is straight forward.
  • To branch from one point to other only a simple 'goto' statement is used.
  • Even to repeat a part of the program 'goto' statement is used.
  • Every logic of the program is developed using only 'goto' statement.
Merits of unstructured technique 
The unstructured technique of programming although having some merits is not at all entertained to design the programs. The merits to just list are:
  • The program designed is simple.
  • The logic is simple and straight forward.
  • Only one statement 'goto' is used for branching as well as looping.
Demerits of unstructured technique
The unstructured technique of programming is very rarely used. It is never entertained because of its demerits. The demerits of the unstructured technique are:
  • To follow the logic of the program is very difficult.
  • There may be abrupt transfer from one point to another.
  • This technique can be applied only to small-scale programs.
  • Difficult to keep track the logic of the program.
  • Excessive use of 'goto' statements causes confusion in program flow.
  • The quality of the program decreases as the number of 'goto' statements increases.
  • Program designed using this technique is not clear for the others and also at times to the designer of the program.
  • It is difficult for the programmer to understand the logic at the later stage.
  • Because of excessive use of 'goto' statements tracing the error is very difficult.
  • Testing of program consumes lots of time.
  • Redesigning a program is much more difficult.
  • Unstructured programs consist of statements that are not grouped for specific tasks.
  • The logic of such programs is messy with details and therefore difficult to follow.

Comments

Popular Post

Polynomial representation using Linked List for Data Structure in 'C'

Polynomial representation using Linked List The linked list can be used to represent a polynomial of any degree. Simply the information field is changed according to the number of variables used in the polynomial. If a single variable is used in the polynomial the information field of the node contains two parts: one for coefficient of variable and the other for degree of variable. Let us consider an example to represent a polynomial using linked list as follows: Polynomial:      3x 3 -4x 2 +2x-9 Linked List: In the above linked list, the external pointer ‘ROOT’ point to the first node of the linked list. The first node of the linked list contains the information about the variable with the highest degree. The first node points to the next node with next lowest degree of the variable. Representation of a polynomial using the linked list is beneficial when the operations on the polynomial like addition and subtractions are performed. The resulting polynomial can also

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Memory representation of Linked List Data Structures in C Language

                                 Memory representation of Linked List              In memory the linked list is stored in scattered cells (locations).The memory for each node is allocated dynamically means as and when required. So the Linked List can increase as per the user wish and the size is not fixed, it can vary.                Suppose first node of linked list is allocated with an address 1008. Its graphical representation looks like the figure shown below:       Suppose next node is allocated at an address 506, so the list becomes,   Suppose next node is allocated with an address with an address 10,s the list become, The other way to represent the linked list is as shown below:  In the above representation the data stored in the linked list is “INDIA”, the information part of each node contains one character. The external pointer root points to first node’s address 1005. The link part of the node containing information I contains 1007, the address of