1. INTRODUCTION.pptx.pdf

Full Transcript

INTRODUCTION BY AMIT PATEL Unit 1 ▪ 1.1 Concepts of Programming Language ▪ 1.1.1 Introduction of Source Code, Object Code and executable code ▪ 1.1.2 Algorithm and Flowchart ▪ 1.1.3 Concepts of Structured Programming Language ▪ 1.2 Concepts of Editor, Interpreter...

INTRODUCTION BY AMIT PATEL Unit 1 ▪ 1.1 Concepts of Programming Language ▪ 1.1.1 Introduction of Source Code, Object Code and executable code ▪ 1.1.2 Algorithm and Flowchart ▪ 1.1.3 Concepts of Structured Programming Language ▪ 1.2 Concepts of Editor, Interpreter and Compiler ▪ 1.2.1 Introduction of C program body structure ▪ 1.2.2 Character Set, concepts of variables and constants ▪ 1.2.3 Identifiers, literals, Key words ▪ 1.2.4 Data types ▪ 1.2.5 Concepts of source code, object code and executable code What is Program? ▪ Detailed plan or procedure for solving a problem with a computer. OR ▪ Instructions that tell a computer what to do. OR ▪ A set of instructions that directs a computer's hardware to perform a task is called a program, or software program. ▪ An unambiguous, ordered sequence of computational instructions necessary to achieve such a solution What is Programming Language? ▪ Languages that programmers use to write program are called “Programming languages." OR ▪ Set of commands, instructions, and other syntax use to create a software program ▪ There are 2 type of Language. 1. High Level Language 2. Low level Language What is Programming Language? ▪ High level programming language: Programmers to write instructions in a language that is easier to understand by users. ▪ It is concentrate on logic to solve the problem. ▪ Programming language like C, C++, Java is known as High level programming lanaguage. ▪ In simply, all this language write programming statement in English which is human understand. And those language understand by user is known “High level programming language” What is Programming Language? ▪ Low-level language: Recognized directly by the computer hardware. ▪ It is very close to machine. ▪ Machine cannot understand human language. ▪ It understand language of “0” and “1” (Binary language) ▪ Example: Machine code and Assembly language INTRODUCTION ▪ Python is a general purpose, dynamic, high-level, and interpreted programming language. ▪ It supports Object Oriented programming approach to develop applications. ▪ It is simple and easy to learn and provides lots of high-level data structures. ▪ Python's syntax and dynamic typing with its interpreted nature make it an ideal language for scripting and rapid application development. Parameter High Level Language Low Level Language Hardware knowledge Not required Required Ease of Learning Easy to understand and learn Hard to understand and learn Performance Slow Fast Example C, C++, Java, BASIC Machine and Assembly language Translation Required Not Required Execution Slow Fast Modification Easy Hard Memory Usage More Less Near to Human language Machine Used to Write application program Write hardware program Compilation Require Not require What is source code? ▪ Programming statements that are created by a programmer with a text editor ▪ In C Programming language, we use “Turbo C” editor to create source code. ▪ Source code = Program. ▪ “.C” is extension of “C” program source code. ▪ It cannot be compiled. ▪ It is in human readable, written in “high level language” What is object code? ▪ Object code is the language that a central processing unit can understand. ▪ It can be run on any computer with same CPU architecture. ▪ It has been translated by the compiler from the programming source code. ▪ Once source code is compiled by compiler, it is translated into object code. ▪ Extension : “.obj” ▪ Not understand by human, written in “Low level language” What is executable code? ▪ Executable is the output of a linker after it processes the object code. ▪ Also called the Binary. ▪ Extension:.exe ▪ Executable Code means a form of computer program or portion which can be executed by a computer without further translation or modification. ▪ It can be executed directly by CPU. Executable code Vs Object Code Object Code Executable Code A sequence of statements in binary that is The output of a linker after it processes the generated after compiling the source object code program. Cannot run directly by the CPU. Executable code can be run directly by CPU Extension:.obj Extension:.exe “C” Program execution background story. ▪ There are basically three steps involved in converting your ideas into what is to be done to make it a working program. There are three steps involved in converting your idea of what is to be done to a working program. 1. Creating a source code. 2. Compile the source code and produce an object file. 3. Linking all the object files and libraries to produce an executable code. Algorithm ▪ Before starting any work , we have to plan or design how to complete it. ▪ Definition: An algorithm is a set of well-defined instructions to solve a particular problem. ▪ It is a step by step instruction to solve the problem. ▪ It takes a set of input and produces a desired output. ▪ Based on algorithm it is easy for programmer to write programming statements. NOTE: ▪ In computer programming, before solving any program , we have to write algorithm. An algorithm to add two numbers: ▪ Take two number inputs ▪ Add numbers using the + operator ▪ Display the result Characteristics of Algorithm Algorithm Characteristics ▪ Clear and Unambiguous: Algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning. ▪ Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs. ▪ Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well. ▪ Finiteness: The algorithm must be finite, i.e. it should not end up in an infinite loops or similar. Algorithm Characteristics ▪ Feasible: The algorithm must be simple, generic and practical, such that it can be executed upon will the available resources. It must not contain some future technology, or anything. ▪ Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be same, as expected. Algorithm : Advantages ▪ It is a step-wise representation of a solution to a given problem, which makes it easy to understand. ▪ An algorithm uses a definite procedure. ▪ It is not dependent on any programming language, so it is easy to understand for anyone even without programming knowledge. ▪ Every step in an algorithm has its own logical sequence so it is easy to debug. ▪ By using algorithm, the problem is broken down into smaller pieces or steps hence, it is easier for programmer to convert it into an actual program. Algorithm : Disadvantages ▪ Algorithms is Time consuming. ▪ Difficult to show Branching and Looping in Algorithms. ▪ Big tasks are difficult to put in Algorithms. Write an Algorithm to print your name. ▪ Step 1 : START ▪ Step 2 : Take an element X ▪ Step 3 : Store your name in X ▪ Step 4 : Print / Display X ▪ Step 5 : STOP Write an Algorithm to print addition of two numbers. ▪ Step 1 : START ▪ Step 2 : Declare a=10 and Declare b=10 ▪ Step 3 : Calculate c = a+b ▪ Step 4 : Display c ▪ Step 5 : STOP Write an Algorithm to print cube of number. ▪ Step 1 : START ▪ Step 2 : Declare a=10 OR read value of a. ▪ Step 3 : Calculate c = a*a*a ▪ Step 4 : Display c ▪ Step 5 : STOP Write an algorithm to print 12th marksheet ▪ Step 1 : START ▪ Step 2 : Declare name=“VTCBB” and seatnum=“20BCA151” ▪ Step 3 : Declare cs=90,maths=99,ic=90,cppm=36,dma=90 ▪ Step 4 : Display name, Seatnum ▪ Step 5 : Display cs,maths,ic,cppm,dma ▪ Step 6 : Calculate t=cs+maths+ic+cppm+dma ▪ Step 7 : Calculate per=t/5 or t*100/500 ▪ Step 8 : Display t and per. ▪ Step 9 : Stop Write an algorithm to print 12th marksheet ▪ Step 1 : START ▪ Step 2 : Declare variable name, seatnum, cs, maths, ic, cppm, dma ▪ Step 3 : Read all variable value. ▪ Step 4 : Display name, Seatnum ▪ Step 5 : Display cs,maths,ic,cppm,dma ▪ Step 6 : Calculate t=cs+maths+ic+cppm+dma ▪ Step 7 : Calculate per=t/5 or t*100/500 ▪ Step 8 : Display t and per. ▪ Step 9 : Stop Flowchart ▪ Definition: A flowchart is a type of diagram that represents an algorithm. ▪ Flowcharts normally use standard symbols to represent the different types of instructions. ▪ These symbols are used to construct the flowchart and show the step-by-step solution to the problem. Flowchart : Advantages ▪ Communication : Flowchart are better way of communicating the logic of the system ▪ Effective analysis: With the help of flowchart, a problem can be analyzed in a more effective way. ▪ Efficient Coding: The flowchart act as a guide or blue print during the system analysis and program development phase. ▪ Proper debugging : The flowchart helps in debugging process. Debugging means finding and correcting problems or mistakes or errors. ▪ Proper documentation: A flowchart serves as a good program documentation which is needed for future purpose. ▪ Efficient program maintenance: Using the flowchart, we can easily manage the program or a system. Flowchart : Disadvantages ▪ It is difficult to draw flowchart for large and complex programs. ▪ In this their is no standard to determine the amount of detail. ▪ Difficult to reproduce the flowcharts. ▪ It is very difficult to modify the Flowchart. Draw a flowchart to make a tea START TAKE A BOWL ADD WATER AND MILK STOP Draw a flowchart to print a square of number START DECLARE A=10 CALCULATE C=A*A DISPLA YC STOP WRITE AN ALGORITHM, FLOWCHART, SAMPLE CALCULATION TO FIND MINIMUM OF TWO NUMBERS ▪ STEP 1 : START ▪ STEP 2 : DISPLAY “ENTER VALUE OF A” ▪ STEP 3 : READ A ▪ STEP 4 : DISPLAY “ENTER VALUE OF B” ▪ STEP 5 : READ B ▪ STEP 6 : IF A

Use Quizgecko on...
Browser
Browser