Today, we will discuss The Role of Algorithms in Programming. Dear C++ beginner programmers, before writing a program design an algorithm first. This will make the whole programming process easy and less prone to errors. So, first of all we define an algorithm and learn its basic concepts.
Algorithm
An algorithm is a step-by-step procedure to solve a problem. It is better to write algorithm before writing the actual computer program. Writing algorithm first, will help to write a better program with less errors. Why algorithm is so important in program development process? We answer this question by discussing the advantages of algorithms in program development, as follows:Advantages of Algorithms
Following are the advantages of writing algorithm before writing program:1. Reducing Complexity
Programming is one of the most complex jobs. Writing algorithm before program makes the job simple, because we divide big task into smaller sub tasks. Each sub task is solved separately2. Flexibility
Algorithm is written so that the program may be written in any language e.g. Visual Basic, Java or C++ etc.3. Easy to understand
Algorithm is written in English like statements. So it is easy to understand.Example 1: The Role of Algorithms in Programming
Write an algorithm to input two numbers from the user, calculate its sum (total) and then display the result.1. Input X, Y
2. Total = X+Y
3. Display Total
4. End
Example 2: The Role of Algorithms in Programming
Write an algorithm to input 5 numbers from the user, calculate its average and then display the result.1. Input A, B, C, D, E
2. Total = A+B+C+D+E
3. Average=Total / 5
4. Display Average
5. End
While studying The Role of Algorithms in Programming we also discuss the basic properties of an algorithm:
Properties of Algorithm
Following are some properties of an algorithm:1. Algorithm must provide the complete solution of the problem
2. Algorithm must finish in finite time period
3. Each instruction in algorithm must be executed in finite time period
4. The given problem should be broken down into simple and meaningful steps.
5. The steps should be numbered sequentially.
6. The steps should be descriptive and written in simple English.
Basic Structure of a C++ Program
C++ Program Development Cycle
How To Write, Compile and Run Your First C++ Program
How To Start Turbo C++ IDE
How To Install Turbo C++ 3.0 - IDE
Features of C++ Programming Language
Brief History of C++
Flowcharts in Computer Programming
The Role of Algorithms in Programming
How To Start Computer Programming
What is a Computer Program
- See more at: http://easycppprogramming.blogspot.com
0 comments:
Post a Comment
We Love To Hear From You!