Upload
trevor-arnold
View
225
Download
0
Tags:
Embed Size (px)
Citation preview
CISC105 General Computer Science
Class 1 – 6/5/2006
Important Notes!
• The lab session has been moved from 040 Smith Hall to 009 Willard Hall. It will meet at the same day and time.
Computer Hardware
Main Memory
• Memory Cells• Address• Memory content
– Data– Program Instruction
• RAM vs. ROM – Random Access
Memory = volatile– Read Only Memory =
non-volatile
Bits and Bytes
• Information stored in memory as bits
• 8 bits = 1 Byte• 1 b vs. 1 B• 1 KB = 1024 B • 1 GB = 1024 MB =
1,048,576 MB = 1,073,741,824 B
Secondary Storage
• Secondary Storage is used for long term storage of programs and information
• Information is stored in Files, directories and subdirectories
Central Processing Unit (CPU)
• “Brain” of the computer with 2 primary functions
– Coordinate all computer operations– Performing arithmetic and logical operations on data
• CPU follows instructions contained in a computer program
– Fetch Instruction -> Interpret Instruction -> retrieve data (if necessary) -> carry out instruction
– Uses Registers (high speed memory) to speed up retrieval
Input Devices
• Input Devices - Any device used to enter information into a computer– Keyboard, Mouse, Digitizer etc.
Output Devices
• Output Devices used to observe the results of the data manipulation
• Monitor, printer, etc.
Computer Network
• Local Area Network (LAN) – computers and peripherals connected together in order to share resources. Usually contained in a building.– Network Printers, Scanners, secondary storage (file
servers) etc.
Computer Network (WAN)
• Wide Area Network (WAN) – a network that attaches a large number of computers over a large geographic area.
• The Internet is the most well know WAN (WWW and GUI via Browser)
How to connect to Networks
• Modem - Use a telephone line (modulator / demodulator) - transmit up to 50,000 bps
• Digital Subscriber Line (DSL) – uses telephone line but can have simultaneous voice communication. (~1.5 Mbps)
• Cable Internet access – uses the coax cable that is used to deliver TV to your house
Computer Software
• Operating System
• Application Software
• Computer Languages
• Software Development Method
Operating System
• Operating System (OS) - Collection of programs that control the interaction of the user and computer hardware
• Booting a computer – loading the OS into memory
OS Responsibilities
• Communicating with the computer users
• Managing memory allocation, processor time and other resources
• Collecting input from Input devices
• Conveying output to screen, printer, etc
• Fetch data from secondary storage
• Write data to secondary storage
Application Software
• Application – software used for a specific task – word processing, email, accounting, etc
• Applications are made available by installing them.
• Must be compatible with the Hardware and operating system you are using.
Computer Languages
• Machine language – collection of binary numbers – Only understood by a specific CPU– Not very readable– Not standardized
• Assembly Language – mnemonic codes that correspond to machine language– Suffers from same problems as Machine
Language
Computer Languages
• High-Level language– CPU independent– Combine algebraic expressions
• A compiler will translate a high-level source file into machine code
• Syntax is very important!
• Some developers use an IDE to
Entering, Translating, and Running
a High-Level Language Program
Flow of information during program execution
Software Development Method
• PAD IT Man!– Problem Definition– Analyze the Problem– Design Algorithm– Implement the Algorithm– Test and verify the program– Maintain and Update the program
Software Development Method (example)
• Problem definition: Your job requires you to convert miles to kilometers.
• Analysis: – Program input: distance in miles– Program output: distance in kilometers– Relevant Formula: 1 mile = 1.609 kilometers
Software Development Method (example)
Design
1. Get the distance in miles
2. Convert the distance to kilometers1. Distance in kilometers is 1.609 times the
distance in miles
3. Display the distance in kilometersCheck the algorithm = 10 miles
times 1.609 = 16.09km
Software Development Method (example)
• Implement and test
Chapter 2
• C Language Elements• Variable Declaration and Data Types• Executable Statements• General Form of a C program• Formatting Numbers in Output• Interactive Mode, Batch Mode, and Data
Files• Common Programming Errors
Variable Declaration and Data Types
• Variable – a name associated with a memory cell whose value can change
• Variable Declaration – statements that communicate to the compiler the names of the variables in the program and the kind of information it stores.
• Data Types – a set of values and operations that can be performed on those values
Executable Statements• Assignment Statements – an instruction that
stores a value or a computational result in a variable
Executable Statements
I/O Statements - printf
• printf is an output statement supplied by the stdio.h library
• printf is executed by running a function call– printf(“That equals %f kilometers.\n”, kms);
• Function arguments• Format String (placeholders – multiple
placeholders)• Print list• \n and the cursor