Download presentation
Presentation is loading. Please wait.
Published byAbigail Allison Modified over 8 years ago
1
Chapter 1: Introductory Concepts Dr. Ameer Ali
2
Overview Introduction to computers Computer characteristics Modes of operation Types of programming languages Introduction to C Sample C program Chapter 5: Preparing and running a complete C programming
3
Introduction to Computers History
4
Computer Characteristics Basically electronic devices that can transmit, store, and manipulate information Different types of data can be processed by a computer Numeric data, character data, graphic data, sound. To process a set of particular data, the computer must be given an appropriate set of instructions called program. This program is entered into the computer and then stored into memory.
5
Computer Characteristics A stored program can be executed at any time and followings are happen: Input data is entered into the computer Input data are process to get desired result or output Processed output can be displayed into the monitor
6
Memory Stored as 0 and 1 and known as bit (binary digit) 8 bit is one bit 2 10 Byte= 1024 byte=1KB 2 10 KB= 1024 KB=1MB 2 10 MB= 1024 MB=1GB 01100101
7
Speed and Reliability High speed and takes approximately 10 -6 sec for one instruction High reliable and can never mistake with its own accord
8
Modes of Operation Batch Processing Time sharing Interactive Computing: commercial time sharing
9
Types of Programming Language Low level: machine language Very detailed, cryptic instructions that control computer’s internal circuitry Very few computer programs are written in machine language due to: (i) very cumbersome to work with it and (ii) different type of computers has its own instructions High Level: C language Compatible with human language
10
High Level: C language Compatible with human language Significant advantages over machine language: simplicity, uniformity and portability i.e. machine independence
11
Introduction to C Structured programming languages Developed in 1970’s at bell telephone laboratories Confined until 1978 and then published After this, development of computer grown rapidly Used for system programming and application programming
12
Introduction to C Large number of operators included with C and ability to write very concise source program Features and capabilities can easily be extended Available for all size computers Highly portable
13
Structure of C program Include header file Define constant values Write Main program
14
Sample C program Add two numbers a and b #include void main (void) {int a, b, sum; printf(“take input for a=“); scanf(“%d”,&a); printf(“take input for b=“); scanf(“%d”,&b); sum=a+b; printf(“The sum is sum=“, sum); getch(); }
15
Preparing and Running Save it into specific directory as test.cpp Compile and check error Cursor will indicate where the error is After successful compilation, run from the toolbar or ctrl+F9 Give proper input if required and then you will get output
16
Preparing and Running If the program is not giving you the proper output, then debug program using debugger. Practice: Calculate P=C(1+i) n Calculate addition, subtraction, multiplication, and division
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.