260 likes | 279 Views
Learn about programming essentials, algorithms, control structures, pseudo-code, flowcharts, and various programming languages. Understand differences between low-level and high-level languages, and explore different programming techniques and language processors.
E N D
Introduction • The computer programming involves designing the computer programs to solve different kinds of problems as well as to control different operations of the computer • A computer is nothing without a computer program • A computer program is designed after understanding the problem • To develop a correct program, the programmer must write program instructions in the proper sequence
Example • To find out the average marks of the student • Get the marks of all subjects of the student • Calculate the total marks • Calculate the average marks • Print the average marks
Algorithm • The step-by-step procedure for the solution of the problem is called algorithm • The algorithm represent the sequence of steps or instructions and the order in which these steps are taken for the solution of the problem • An algorithm provides the procedure for the solution of the problem in general terms only • An algorithm is written before writing the actual computer program • It is written by using short English statements
Example • Program to find average and sum of three numbers • INPUT “Enter the first number: ” ; X • INPUT “Enter the second number: ” ; Y • INPUT “Enter the third number: ” ; Z • LET SUM = X + Y + Z • AVG = SUM/3 • PRINT “Sum of three numbers is: ” ; SUM • PRINT “Average of three numbers is: ” ; AVG • END http://rajastutorials.com/program-find-average-and-sum-of-three-numbers-gw-basic/
Altering Order of Algorithm • Algorithm operations are ordered in that there is first instruction, a second instruction etc • An algorithm must have the ability to alter the order of its instructions • An instruction that alters the order of an algorithm is called a control structure
Types of Control Structures • Sequential Structure • Conditional Structure • Iterative Structure
Example http://www.slideshare.net/sajibbgc/algorithms-and-flowcharts-27859039
Pseudo code • Pseudo code is a problem solving tool • It is a generic way of describing an algorithm without use of any specific programming language syntax • Statements in pseudo code represent the logic of actual computer program in natural language • Cannot be compiled nor executed • Also called program design language
Example • If student’s marks is greater than or equal to 50% • Print “Passed” • Else • Print “Failed”
Flow Chart • Graphical or symbolic representation of the solution of a problem • Graphical representation of algorithm or pseudo code • Used to describe the solution of the problem • Easy to understand • Plan to be followed for coding a program • Errors in the logic of the program can be detected very easily in flowchart
Symbols of Flow Chart • Each step in solving the problem is represented by a different symbol • Each symbol also contains a short description about the step • The flow chart symbols are linked together with arrows that show the direction of flow of data or control
Operating System Functions http://www.smartdraw.com/flowchart/flowchart-symbols.htm
Example http://www.slideshare.net/MELJUN2009/flowchart-lecture-16088527
Example http://www.slideshare.net/MELJUN2009/flowchart-lecture-16088527
Example http://cquestionsandanswers.blogspot.com/p/flow-charts.html
Programming Languages • A language is defined as a way of communication between two persons • Programming language is a means of communication between computer and the user • A computer program is written or prepared in programming language • Each programming language has a set of alphabets and rules for writing computer programs
Types of Programming Languages • Low Level Language • Machine Language • Assembly Language • High Level Language • FORTRAN • COBOL • C++
Types of High Level Language • Procedural language • Non-Procedural language • Object Oriented Programming languages
Advantages of High Level Languages • Easy to learn • Easy to understand • Easy to write program • Easy to detect and remove errors • Built in library functions • Machine independence
Difference between Low Level & High Level Languages • Low Level Languages is close to machine language, while High level languages is close to human language • Low Level Languages is machine dependent, while High level languages is machine independent
Programming Techniques • Structured Programming • Object Oriented Programming • Event Driven Programming • Visual Programming
Language Processors • A computer understands instructions in machine code • A program written in any high level programming language is called the source program • The source code cannot be executed directly by the computer • The source program must be converted into machine code before running it on the computer • “The special translator system software that is used to translate the program written in high level language(or assembly language) into machine code is called language translator or language processor”
Types of Language Processors • Compiler • Interpreter • Assembler
Difference between Compiler & Interpreter • Compiler translates the source code into object code as a whole, while interpreter translates the source code into machine code statement by statement • Compiler creates an object file while interpreter does not create object file
References • Introduction to Information Technology by RiazShahid, CM Aslam and SafiaIftikhar • The Concepts of Information Technology by ImranSaeed, AhsanRaza, Tariq Mehmood and ZafarHussain