Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.

Similar presentations


Presentation on theme: "INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics."— Presentation transcript:

1 INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics

2 Course Outline ■Describe the major components in problem solving for a computer program. ■Analyze and write pseudocode to illustrate compact and informal high-level descriptions of computer programming algorithms. ■ Explain the concept of data storage and named memory locations. ■ Apply decision and repetition structures in program design. ■ Write and incorporate methods and functions to demonstrate program competence. ■ Define variables and arrays used in program methodology. ■ Implement input and output to access and process files.

3 Recommended Text Books ■Schaum's Outline of Programming with C++ 2nd Edition by John Hubbard (Author) ■Problem Solving with C++-7th Edition-2009 [48360] by Walter J. Savitch

4 Marking Scheme ■Terminal : 75 ■Sessional 1: 20 ■Sessional 2: 20 ■Quiz + Assignments: 35 ■Total: 150 ■Note: Copied assignments will earn zero marks

5 What is Programming? ■Much of human behavior and thought is characterized by logical sequences of actions applied to objects. ■Our whole civilization is based on the order of things and actions. ■Programming: Planning or scheduling the performance of a task or an event ■Electronic computer: A programmable device that can store, retrieve, and process data ■Data: Information in a form a computer can use ■Information: Any knowledge that can be communicated ■Data type :The specification of how information is represented in the computer as data and the set of operations that can be applied to it ■Computer programming: The process of specifying the data types and the operations for a computer to apply to data in order to solve a problem ■Computer program: Data type specifications and instructions for carrying out operations that are used by a computer to solve a problem

6 How Do We Write a Program? ■A human (the programmer) must analyze the problem ■develop the instructions for solving the problem ■and then have the computer carry out the instructions ■a two-phase process to write a program: problem solving and implementation

7 Problem-Solving Phase ■1. Analysis and Specification. Understand (define) the problem and what the solution must do. ■2. General Solution (Algorithm). Specify the required data types and the logical sequences of steps that solve the problem. ■3. Verify. Follow the steps exactly to see if the solution really does solve the problem

8 Implementation Phase ■1. Concrete Solution (Program). Translate the algorithm (the general solution) into a programming language. ■2. Test. Have the computer follow the instructions. Then manually check the results. If you find errors, analyze the program and the algorithm to determine the source of the errors, and then make corrections Algorithm Instructions for solving a problem or sub-problem in a finite amount of time using a finite amount of data

9 Algorithm: an example Start a car ■1. Insert the key. ■2. Make sure the transmission is in Park (or Neutral). ■3. Turn the key to the start position. ■4. If the engine starts within six seconds, release the key to the ignition position. ■5. If the engine doesn’t start in six seconds, release the key and gas pedal, wait ten seconds, and repeat Steps 3 through 5, but not more than five times. ■ 6. If the car doesn’t start, call the garage.

10 Problem solving ■Given the 3 dimensions of a box (length, width, and height), multiply them together to determine the volume. ■Decomposition:

11 ■2. Eliminate redundant or irrelevant information.

12

13

14 Materialize the correct algorithm into code ■Programming language: A set of rules, symbols, and special words used to construct a computer program ■ Code: Data type specifications and instructions for a computer that are written in a programming language ■Documentation: The written text and comments that make a program easier for others to understand, use, and modify

15 How Is a Program Converted into a Form That a Computer Can Use? ■Machine language The language, made up of binary coded instructions, that is used directly by the computer ■Assembly language A low-level programming language in which a mnemonic is used to represent each of the machine language instructions for a particular computer Assembler A program that translates an assembly language program into machine code ■Compiler A program that translates a program written in a high-level language into machine code ■ Source code Data type specifications and instructions written in a high-level programming language ■Object code A machine language version of source code

16

17 ■High level language allows program portability ■Visual Basic programs are translated into a standard machine language called Bytecode. ■the CLR reads the Bytecode machine language instructions and translates them into machine language operations that the particular computer executes. ■Interpretation is done as the program is running, one instruction at a time ■Linking –The object code for your C++ program must be combined with the object code for routines (such as input and output routines) that your program uses. This process of combining object code is called linking and is done by a program called a linker. For simple programs, linking may be done for you automatically.

18

19 Layout of C++ Program Include directive: It tells the compiler where to find information about certain items that are used in your program Main part of the program Return statement: End of program


Download ppt "INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics."

Similar presentations


Ads by Google