- Definition of Programming
Programming is the process of creating a set of instructions that tell a computer how to perform a task; or we can also understand Programming is the implementation of logic to facilitate specific computing operations and functionality.
- Definition of an Algorithm
-
An algorithm is an effective, efficient and best method which can be used to express solution of any problem within a finite amount of space and timeand in a well-defined formal language.
-
All Algorithms must satisfy the following criteria:
Input: more quantities that are extremely supplied. Output: At least one quantity is produced. Definiteness: Each instruction should be clear and unambiguous. Finiteness: The process should be terminated after a finite number of steps. Effecitveness: Every instruction must be basic enough to be carried out theoretically. 3. Building a Program
3.1. Indentifying problem
Identifying what it is you know (input), and what it is you want to obtain (output) -> produce a written agreement that, among specifies the kind of input, processing, and output required.
3.2. Planning solution
Draw a flowchart or to write pseudocode.
Flowchart is a pictorial representation of a step-by-step solution to a problem, consists of arrows representing the direction the program takes and boxes and other symbols representing actions. It is a map of what your program is going to do and how it is going to do it. Pseudo code permits to focus on the program logic without having to be concerned just yet about the precise syntax of a particular programming language. 3.3. Building algorithm
Build step by step procedure for solving problem.
3.4. Implementing program
Express solution in a programming language; translate the logic from the flowchart or pseudocode-or some other tool-to a programming language.
3.5. Testing and correcting program
Test program on the computer, involves these phases:
Desk-checking: Check the logic of the program to attempt to ensure that it is error-free and workable. Translating: Checks the syntax of program to make sure the programming language was used correctly, giving coder all the syntax-error messages and translates program into a form the computer can understand. Debugging: means detecting, locating, and correcting bugs (mistakes), usually by running the program. In this phase coder runs the program using test data that he devises. 3.6. Documenting program
Documentation is a written detailed description of the programming cycle and specific facts about the program. Typical program documentation materials include the origin and nature of the problem, a brief narrative description of the program, logic tools such as flowcharts and pseudocode, data-record descriptions, program listings, comments and testing results.
- Building an Algorithm
4.1. Natural language
Natural languages are sometimes referred to as knowledge-based languages, because natural languages are used to interact with a base of knowledge on some subject. The use of a natural language to access a knowledge base is called a knowledge-based system.
Example: "If this number is 1, print case 1 on display. If this number is 2, print case 2 on display".
4.2. Flow diagram
A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.
Example:
4.3. Pseudo code
Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward.
Example:
START
READ INPUT into x
IF x is 1 THEN
PRINT "I am case 1”
IF x is 2 THEN
PRINT "I am case 2"
RETURN 0
4.4. Language programming
A programming language is a computer language that is used by programmers (developers) to communicate with computers. It is a set of instructions written in any specific language (C, C++, Java, Python) to perform a specific task.
Example:
int main()
{
int x; scanf ("%d", &x); if (x == 1) { printf (“I am case 1”); } if (x == 2) { printf (“I am case 2”); } return 0;
}