Name: Dr. Gufran Ahmad Ansari
Name: Dr. Gufran Ahmad Ansari
WHAT IS COMPUTER
Input unit
Obtains information from input devices (keyboard, mouse)
Output unit
Outputs information (to screen, to printer, to control other
devices)
Memory unit
Rapid access, low capacity, stores input information
Arithmetic and logic unit (ALU)
Performs arithmetic calculations and logic decisions
Central processing unit (CPU)
Supervises and coordinates the other sections of the
computer
Secondary storage unit
Cheap, long-term, high-capacity storage
Stores inactive programs
TYPES OF COMPUTER
Analog Computer
Digital Computer
Hybrid Computer
Analog Computer
The Microcomputer
These are the most frequently used computers better known by the
name of “Personal computers”. This is the type of computer meant
for public use. Other than Desktop
The Mini Computer
Linux
Unix
Windows 2000
Multiprocessing - An operating system capable of supporting and
utilizing more than one computer processor. Below are some
examples of multiprocessing operating systems.
Linux, Unix
Types of Languages
Three types of programming languages
Machine languages
Strings of numbers giving machine specific instructions
Example:
+1300042774
+1400593419
+1200274027
Assembly languages
English-like abbreviations representing elementary
computer operations (translated via assemblers)
Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
High-level languages
Steps in learning C:
Alphabets Constants
Digits Variables Instructions
Special symbols Keywords
Program
Alphabets A, B, ….., Y, Z
a, b, ……, y, z
Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Special symbols ~ ‘ ! @ # % ^ & * ( ) _ - + = | \ { }
[]:;"'<>,.?/
C Constants
Array
Integer Constant
Pointer
Real Constant
Union
Character Constant Enum, etc.
Rules for Constructing Integer Constants:
Real constants are often called Floating Point constants. The real
constants could be written in two forms—Fractional form and
Exponential form.
Following rules must be observed while constructing real
constants expressed in fractional form:
Ex.: +325.34
426.0
-32.36
Following rules must be observed while constructing realconstants
expressed in exponential form:
Ex.: +3.2e-5
4.1e8
-0.2e+3
-3.2e-5
Rules for Constructing Character Constants
Welcome to C!
/* Calculation of simple interest */
/* Author Name: 25/09/2010 */
main( )
{
int p, n ;
float r, si ;
p = 100 ;
n=3;
r = 4.5 ;
/* formula for simple interest */
si = p * n * r / 100 ;
printf ( "%f" , si ) ;
}
Basics of a Typical C Program
Development Environment
Editor Disk
• Phases of C++ Preprocessor
Preprocessor program
Disk processes the code.
Programs: Compiler creates object
Compiler
1. Edit Disk code and stores
it on disk.
2. Preprocess Linker Disk Linker links the object
Memory code with the libraries
3. Compile Primary
Primary Memory
Loader
4. Link Loader puts program in
5. Load Disk ..
..
memory.
6. Execute
..
Primary Memory
Primary MemoryCPU takes each
CPU instruction and executes it,
possibly storing new data
values as the program
..
..
..
executes.