GE6151 COMPUTER PROGRAMMING
GE6151 COMPUTER PROGRAMMING • UNIT I INTRODUCTION 8 Generation and Classification of Computers- Basic Organization of a Computer –Number System – Binary – Decimal – Conversion – Problems. Need for logical analysis and thinking – Algorithm –Pseudo code – Flow Chart. UNIT II C PROGRAMMING BASICS 10 Problem formulation – Problem Solving - Introduction to ‘ C’ programming –fundamentals – structure of a ‘C’ program – compilation and linking processes – Constants, Variables – Data Types – Expressions using operators in ‘C’– Managing Input and Output operations – Decision Making and Branching – Looping statements – solving simple scientific and statistical problems. UNIT III ARRAYS AND STRINGS 9 Arrays – Initialization – Declaration – One dimensional and Two dimensional arrays. String- String operations – String Arrays. Simple programs- sorting- searching – matrix operations. UNIT IV FUNCTIONS AND POINTERS 9 Function – definition of function – Declaration of function – Pass by value – Pass by reference – Recursion – Pointers - Definition – Initialization – Pointers arithmetic – Pointers and arrays- Example Problems. UNIT V STRUCTURES AND UNIONS 9 Introduction – need for structure data type – structure definition – Structure declaration – Structure within a structure - Union - Programs using structures and Unions – Storage classes, Pre-processor directives.
UNIT I INTRODUCTION Generation and Classification of Computers- Basic Organization of a Computer –Number System – Binary – Decimal – Conversion – Problems. Need for logical analysis and thinking – Algorithm –Pseudo code – Flow Chart.
INTRODUCTION Early days people use fingers for computing purpose. As years go, the computing needs also grew. This leads to the invention of calculators and computers. The term computer is derived from the word compute. The word compute means to calculate
Definition A Computeris an electronic machine that accepts data from the user, processes the data by performing calculations and operations on it, and generates the desired output results. Computer performs both simple and complex operations, with speed and accuracy. COMPUTER INPUT OUTPUT
Definition • 1.”Computer is an electronic Device that is used for performing calculations and controlling operations that can be expressed either in logical or numerical terms”. • 2.”Computer is an electronic device which automatically accepts and stores input data process them and produce the desired result”. • 3.“Computer may be defined as an electronic device, that operates upon information or data”.
Basic functions or operations Input Processing Output Storing Controlling
Applications of computer Business Industry Home Education Printing & publishing Entertainment etc.,
CHARACTERISTICS OF COMPUTER Speed Accuracy Diligence Versatility Resource sharing Storage
CHAPTER 1 Generation and Classification of Computers
Generations of Computers (Cont) First Generation Computers: These computers were vacuum tube based machines. They used magnetic drums for memory. Input were fed into the computer using Punched cards The size of these computers were very large and it produce more heat. They lacked in versatility and speed. They were more expensive.
Generations of Computers (Cont) Second Generation Computers Here the Transistorreplaced the bulky vacuum tubes. Transistors are smaller than vacuum tubes and have higher operating speed. Thus the size of the computer got reduced considerably. Manufacturing cost was also very low.
Generations of Computers (Cont) Third Generation Computers These computers were based on Integrated Circuits(ICs) Technology. A single IC has many transistors, registers and capacitors built on a single thin slice of silicon. So that the size of the computer got further reduced. These Computers were small in size, low cost, large memory and processing speed is very high.
Generations of Computers (Cont) Fourth Generation Computers It uses large scale Integrated Circuits(LSIC) built on a single silicon chip called microprocessors . Later very large scale Integrated Circuits (VLSIC) replaced LSICs These computers are called microcomputers. Thus the size of the computer got reduced. The personal computer (PC) are comes under the Fourth Generation.
Generations of Computers (Cont) Fifth Generation Computer The speed is extremely high in fifth generation computer. The concept of Artificial intelligence has been introduced to allow the computer to take its own decision. It is still in a developmental stage .
Fast Expensive Complex Large Slow Cheap Simple Small Figure 1.8 . Classification of computers based on size and type
Microcomputer • Microcomputers are small, low cost and single-user digital computer • consist of CPU,input unit, output unit, storage unit and the software. • stand alone machines-can be connected together to create a network • Example: • IBM PC based on Pentium microprocessor and Apple Macintosh • Microcomputers include • desktop computers • notebook computers or laptop, • tablet computer • handheld computer • smart phones and netbook
Netbook Laptop PC Figure 1.9 Microcomputers Smart phone • Tablet • PDA
Mini Computer • This is designed to support more than one user at a time • It possesses large storage capacity and operates at a higher speed • This type of computer is generally used for processing large volume of data in an organization. • Eg: Servers in Local Area Networks (LAN).
Mainframe Computers • They operate at very high speed, having very large storage capacity and can handle the work load of many users • They are generally used in centralized databases. Mainframe computer
Supercomputers • They are the fastest and most expensive machines • They have high processing speed compared to other computers • They have also multiprocessing technique • Supercomputers are mainly being used for whether forecasting, biomedical research, Space Research and other areas of science and technology
Basic organization of computer CONTROL INPUT MEMORY OUTPUT ALU
Basic organization of computer INPUT The input unit is used to information or instruction to the computer. It accept the information or instruction from user or from some where else. Convert it to a computer understandable form and send it to the computer. Eg:Keyboard,mouse,Joystick,MICR, etc,.
Basic organization of computer (cont) CENTRAL PROCESSING UNIT (CPU) It is the heart of the computer. It performs all operations. It contains the followings CONTROL UNIT ALU MEMORY
Basic organization of computer (cont) CONTROL UNIT It controls all other units in the computer. It directs the sequence in which operations to be performed. It also controls the flow of data between various units.
Basic organization of computer (cont) MEMORY UNIT Place for holding the information. Types 1.Primary 2.Secondary Primary memory is used to store temporary data. Eg:RAM,ROMetc,. Secondary memory is used to store information permanently. Eg:Hard disk.
Basic organization of computer OUTPUT The output unit is used to display the result of the process. Eg:Monitor,printer,speakers, etc,.
Data Representation • The data stored in the computer may be of different kinds, as follows: • Numeric data (0, 1, 2, ... , 9) • Alphabetic data (A, B, C, ... , Z) • Alphanumeric data-Combination of any of the symbols-(A, B, C .. Z), (0,1..9),orspecial characters (+,-, Blank), etc. • All kinds of data, be it alphabets, numbers, symbols, sound data or video data, is represented in terms of 0s and 1s, in the computer. • Each symbol is represented as a unique combination of 0s and 1s.
Number system • A number system in base r or radix r uses unique symbols for r digits. One or more digits are combined to get a number. • baseof the number decides the valid digits that are used to make a number. • In a number, thepositionof digit starts from right-hand side of the number. • Rightmost digit has position 0, the next digit on its left has position 1, and so on. • The digits of a number have two kinds of values: • Face value • Position value • Thefacevalue of a digit is the digit located at that position. • For example, in decimal number 52, face value at position 0 is 2 and face value at position 1 is 5.
Theposition value of a digit is (base Position). For example, in decimal number 52, the position value of digit 2 is 10° and the position value of digit 5 is 101. Decimal numbers have a base of 10. • Thenumberis calculated as the sum of, face value * base position, of each of the digits • For decimal number 52,the number is 5*101 + 2*10° = 50 + 2 = 52 • In computers, we concerned with four kinds of number systems, as follows: • Decimal Number System -Base 10 • Binary Number System -Base 2 • Octal Number System - Base 8 • Hexadecimal Number System -Base 16
Number System Number Base B => B symbols Base 16 (Hexa) : 0, 1,……9, A ,…, E, F Base 10 (Decimal) : 0, 1, 2,……, 7, 8, 9 Base 8(Octal) : 0, 1, 2, 3, 4, 5, 6, 7 Base 2 (Binary) : 0, 1
Number System (cont) Number representation: d31d30 ... d2d1d0 is a32 digit number value = d31x B31 + d30 x B30 + ... + d2 x B2 + d1 x B1 + d0 x B0
Decimal Numbers: Base 10 Base or Radix is 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9Example: 41210 = 4x102 + 1x101 + 2x100 = 400 + 10 +2 = 412
Binary Numbers: Base 2 Base or Radix is 2 Digits: 0, 1Example: 1012= 1x22 + 0x21 + 1x20 = 4 + 0 +1 = 5
Octal Numbers: Base 8 Base or Radix is 8 Digits: 0, 1, 2, 3, 4, 5, 6, 7Example: 1238 = 1x82 + 2x81 + 3x80 = 64 + 16 +3 = 83
Hexadecimal Numbers: Base 16 Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F: A 10 B 11 C 12 D 13 E 14 F 15 Example: 1216 = 1x161 + 2x160 = 16 +2 = 18