Beruflich Dokumente
Kultur Dokumente
WHAT IS A COMPUTER?
Computer
A
Computer programs
Sets
Hardware
Various
Examples: keyboard, screen, mouse, disks, memory, CDROM, and processing units
Software
Collection
COMPUTER ORGANIZATION
unit
Output
unit
Memory
unit
Arithmetic
Central
Secondary
storage unit
EVOLUTION OF OPERATING
SYSTEMS
Batch processing
Do
Operating systems
Manage
Multiprogramming
Many
Timesharing
Perform
Personal computers
a small portion of one users job then moves on to service the next user
Distributed computing
Organizations
Client/server computing
Sharing
languages
Assembly
languages
High-level
languages
ANSI C
Established
C++ spruces up C
Provides
STANDARD LIBRARY
C standard library
Provides
INTRODUCTION TO C
PROGRAMMING
C language
Facilitates
Structured programming
Disciplined
Preprocessor
Compiler
Linker
Loader
Disk
Disk
Programiscreatedin
theeditorandstored
ondisk.
Disk
Preprocessorprogram
processesthecode.
Disk
Compilercreates
objectcodeandstores
itondisk.
Disk
Linkerlinkstheobject
codewiththelibraries,
createsa.outand
storesitondisk
Primary
Memory
Loaderputsprogram
inmemory.
..
..
..
Primary
Memory
CPU
..
..
..
CPUtakeseach
instructionand
executesit,possibly
storingnewdata
valuesastheprogram
executes.
VARIABLES
Variables
Location
program
A quantity whose value may changed during execution of the
program is called variable
Must be declared with a name and a data type before they
can be used
Some common data types are:
Example:
Example:
int myvariable;
int variable1, variable2;
MEMORY CONCEPTS
Variable names
Correspond to locations in the computer's
memory
Every variable has a name, a type, a size and a
value
Whenever a new value is placed into a
variable, it replaces the previous value - it is
destroyed
Reading variables from memory does not
change them
A visual representation
integer1
45
ARITHMETIC
Arithmetic calculations
Use
7 / 5 evaluates to 1
Modulus
7 % 5 evaluates to 2
Operator precedence
Some
Example:
Do not use: a + b + c / 3
Use: (a + b + c ) / 3
ARITHMETIC
if structure
Test
DECISION MAKING:
EQUALITY AND
RELATIONAL OPERATORS
Standard algebraic
equality operator or
relational operator
C++ equality
or relational
operator
Example
of C++
condition
Meaning of
C++ condition
Relationaloperators
>
>
x>y
xisgreaterthany
<
<
x<y
xislessthany
>=
x>=y
xisgreaterthanorequaltoy
<=
x<=y
xislessthanorequaltoy
Equalityoperators
==
x==y
xisequaltoy
!=
x!=y
xisnotequaltoy