790 likes | 1.33k Views
Introduction to Computer Science. By Wanshanshan wss@bucea.edu.cn. Course Summary. Computer Concepts ( 30% ) C Programming ( 70% ). “ Introduction to Computer Science”. Class : Total 64 hours Lecture 32 hours, Lab 32 hours Grading: Final exam 60% Others 40%
E N D
Introduction to Computer Science By Wanshanshan wss@bucea.edu.cn
Course Summary • Computer Concepts(30%) • C Programming(70%)
“Introduction to ComputerScience” • Class : Total 64 hours Lecture 32 hours, Lab 32 hours • Grading: Final exam 60% Others 40% • Website: http://jxzx.bucea.edu.cn/jsjjc.html • Time:Mon. 5-6 Basic Teaching A-517 • Wed. 5-6 Basic Teaching B-203
Computer Concepts Part.1 Computer Basics Part.2 Microsoft Windows 2003 Part.3 Microsoft Word 2003 Part.4 Microsoft Excel 2003 Part.5 PowerPoint 2003 Part.6 Internet Basics and Applications Part.7 Access Introduction
Preview When you have completed this chapter you should be able to • Define the term “computer” • Describe the relationship between computer hardware and software • Identity the parts or hardware components of a typical PC • List the peripheral devices that are typically found on a PC • Describe the purpose of a computer operating system and recognize popular OSs • Classify software as either system or application software
What is a computer? (Von Neumann’s definition) • Adopt binary system • Store Information A computer is a multipurpose device that accepts input, process data, stores data, and produces output, all according to a series of stored instructions.
运算器 寄存器 控制器 CPU 主机 随机存储器(RAM) 只读存储器(ROM) 高速缓冲存储器 内存 硬件 输入设备:键盘、鼠标、扫描仪 输出设备:显示器、打印机 外存:软、硬盘、光盘、闪存 网络设备:网卡、调制解调器等 计算机系统 外部设备 操作系统:Windows、Unix、Linux 语言处理程序:C、Pascal、VB等 实用程序:诊断程序、排错程序等 系统软件 软件 办公软件包、数据库管理系统 应用软件 计算机系统的构成
A computer acceptsinput • “Input” : • The words and symbols in a document, • numbers for a calculation, • pictures, • temperatures from a thermostat, • audio signals from a microphone, • and instructions for completing a process; • An input device gathers and translates input into a form that the computer can process. • Keyboard is the main( standard ) input device
A computer produce output • “output” : results produced by a computer • Reports • Documents • Graphs • Music • The main output device: • monitor • printer
A computer processes data • data– refers to the symbols that represent facts, objects, and ideas • “process data” : • Performing calculations • Modifying documents and pictures • Sorting lists of words or numbers • Drawing graphs, • A computer processes data unit in a device is called the central processing unit (CPU)
A computer stores data • “Store data” : perform automatically • Memory - data waiting to be used • Storage - data left on a permanent basis while it is not needed for process • File - is a named collection of data that exists on a storage medium
What’s so significant to store instructions • computer program ---The series of instructions that tells computer how to carry out processing tasks. • Software-- programs • What kind of software do computer run? • System software • Application software
The Evolution of Computer History 1.The First Generation- Vacuum Tubes(1946-1956)(电子管) 1946 ENIAC (Electronic numerical integrator and calculator) General-purpose electronic digital computer Wartime needs Decimal Programmed manually • EDVAC (The Von Neumann Machine) (Electronic discrete variable automatic computer) Binary Stored-program concept Had general structure and function
by John von Neumann The Evolution of Computer • Weight:30t • Storage:80 byte • Speed:5000/s • 18,000 tubes Alan Mathison Turing
The Evolution of Computer 1950s The birth of Computer Industry Commercial Computers IBM:Series of 700/7000 2. The Second Generation: Transistors(1957-1964)(晶体管) 1947 Bell Labs invented transistor The late 1950s NCR, RCA Deliver the new technology IBM 7094 Size of memory grew from 2K to 32K. Memory cycle time (the time to access one word of memory )fell from 30µs to 1.4 µs. Note: 1K = 210=1024 磁心存储器
The Evolution of Computer 3. The Third Generation: Integrated Circuits (1965-1971)集成电路计算机 集成电路 一台百万次集成电路计算机
The Evolution of Computer 4. Later Generations (1972-至今) Large-scale integration (LSI): >1000 components Very-large-scale integration (VLSI):>100,000 components Microprocessors: ->microcomputer(pc) All of the components of a CPU on a single chip the difference of computer and microcomputer: 1) microprocessor; 2) bus structure LSI和VLSI
代次 起止年份 所用电子元器件 数据处理方式 运算速度 应用领域 第一代 1946~1957 电子管 汇编语言、代码程序 几千~几万次/秒 国防及高科技 第二代 1958~1964 晶体管 高级程序设计语言 几万~几十万次/秒 工程设计、数据处理 第三代 1965~1970 中、小规模集成电路 结构化、模块化程序设计、实时处理 几十万~几百万次/秒 工业控制、数据处理 第四代 1970~今 大规模、超大规模集成电路 分时、实时数据处理、计算机网络 几百万~上亿条指令/秒 工业、生活等各方面 计算机发展的四个阶段
The Category of Computer Category (usage, cost, size, capability) commonly used computer categories • Microcomputer (personal computer) • Servers • Mainframes • Supercomputers
Personal computer • Microprocessor-based computing device for an individual Workstation: Two meanings– 1. an ordinary personal computer connected to a network – 2.powerful desktop computers for high-performance tasks (such as CAD)
Microcomputers • Least powerful, generally employ microprocessors • Are desktop sized or less • Performance and portability • Desktops • Distinctions between workstations • Portables • Notebooks • PDA
2. Server • Serve computers on a network supplying data Client: requests data from a server is referred to as a client
3. Mainframe Large, fast, expensive; Business, government; Provide centralized storage, processing and management for large amount of data; simultaneously handle thousands of users. IBM S/390 G5 Mainframe computer
4. Supercomputer ---- the fastest computers in the world Fastest, most expensive; Designed for “computer-intensive” task, such as molecular calculations, atmospheric modeling or simulating • nuclear Weather forecast, Realistic film animations
Application fields • Scientific computing • Matlab, SPSS, SAS • Data processing • Signal and image processing • Automatic control • Robot, automatic assembly-lines • Computer aided system (CAD, CAM) • Artificial intelligence • Computer network
Section C Digital Data Representation Digital DataRepresentation • Data representation • the form data is stored, processed, and transmitted • Analog and digital • the difference between analog and digital • Digital data is text, number that converted into discrete digits such as 0s and 1s. • Analog data is represented using an infinite scale of values.
Section C Digital Data Representation 1. Representing number • Numeric Data • Numbers used in arithmetic operations • Binary number system • 0 and 1 • Computers store, process and transmit numeric data with binary number system
伏羲八卦图(先天八卦图) 用符号表示的二进制数 莱布尼茨(德) “我的这种不可思议的新发明,……是因为我发现了一位圣人的古代文字的秘密,这位古代圣人,就是3000年多前,中国早期的君王伏羲氏”。
Section C Digital Data Representation 1. Representing number A computeruses a bit as the building block for more complex messages, which are constructed with a series of bits. • 1 bit can convey two units of information.
units of binary system 1 bit 1 byte = 8 bit 1 word = 2 byte 1kB (byte) = 210 B 1MB (MegaByte)= 210 KB 1GB (GigaByte)= 210 MB 1TB (Tricro) = 210 GB
Section C Digital Data Representation Number(数制) • Base/ radix (基数) • Digits (数字符号) • Weight (位权) Some Notation:
数制的转换 数码 权 基数
Section C Digital Data Representation Multinomial unwrapped from the number according to the weight: 1) The Decimal System: (4723.75)10 = 4×103+7×102+2×101+3×100 +7×10-1+5×10-2 2) The Binary System: (11101. 01)2 =1×24+1×23+1×22+0×21+1×20 +0×2-1+1×2-2
Section C Digital Data Representation 1. Representing number 3) The hexadecimal system Base, or radix of 16, digits (0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F) S = { . . . s2 s1 s0.s-1 s-2 s-3 . ..} S=Sn-116 n-1+Sn-216n-2+…+S116 1+S0160 +S-116-1+…+S-m16-m F1.3=15*161+1*160+3*16-1
Section C Digital Data Representation 1. Representing number 4) The octal system Base, or radix of 8 , digits (0,1,2,3,4,5,6,7) S = { . . . s2 s1 s0.s-1 s-2 s-3 . ..} S=Sn-18n-1+Sn-28n-2+…+S181+S080 +S-18-1+…+S-m8-m 23.3=2*81+7*80+3*8-1 83= ?
Number Conversion 1) Conversion between Binary and Decimal To convert from decimal to binary, the integer and fractional parts are handled separately.
Number Conversion a) Convert decimal integer N into binary form: N =(1 ×2k) + (Rk × 2k-1) + .. . + (R3 × 22) + (R2 × 21) + (R1 ×20) Repeated division Ex. Decimal 11 Quotient Remainder 11/2 = 5 1 5/2 = 2 1 2/2 = 1 0 1/2 = 0 1 1 0 1 1 (11)10= (1011)2
b) Fractional part involved repeated multiplication. F = (a-1× 1/2)+( a-2× 1/22)+( a-3× 1/23)+... This process is not necessarily exact. Ex. Decimal 0.81 Product Integral Part .1 1 0 0 1 1 0.81 × 2 = 1.62 1 0.62 × 2 = 1.24 1 0.24 × 2 = 0.48 0 0.48 × 2 = 0.96 0 0.96 × 2 = 1.92 1 0.92 × 2 = 1.84 1 (0.81)10= (0.110011)2, (approximate)
0 1 Ex. Decimal 0.25 Product Integral part 0.25×2 = 0.5 0 0.50×2 = 1.0 1 0.2510 = 0.01 (exact)
2) Conversion between Hexadecimal and Decimal Base 16 (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) 0000=0 1000=8 0001=1 1001=9 0010=2 1010=A 0011=3 1011=B 0100=4 1100=C 0101=5 1101=D 0110=6 1110=E 0111=7 1111=F Hexadecimal Decimal Ex.1A16 = (116× 161)+( A16× 160) = (110× 161)+( 1010× 160) = 26 Binary Hexadecimal 1101 1110 0001 = DE116 D E 1
3) Conversion between Octal and Decimal Base 8 (0,1,2,3,4,5,6,7) 000=0 001=1 010=2 011=3 100=4 101=5 110=6 111=7 Octal Decimal Ex. 178 = (18× 81)+( 78× 80) = (8)+ (7) = 15 Binary Octal 101 111 001 = 5718 5 7 1
常用进制数的表示方法 (101.11)10 (101.11)2 (101.11)8 (101.11)16 101.11D 101.11B 101.11O 101.11H 101.11(D) 101.11(B) 101.11(O) 101.11(H) D( Decimal ) 十进制 B( Binary ) 二进制 O( Octal ) 八进制 H( Hexadecimal ) 十六进制 • 120.01 678.05 3AE.0B 肯定不是二进制数 肯定不是二进制数和八进制数 只能是十六进制数
r进制转换为十进制——按权展开 • 十进制数 • 1232.25 = 1 ×103 + 2×102 +3×101 + 2×100 + 2×10-1 + 5×10-2 • 二进制数 • 10110.101 = 1×24 +0×23 +1×22 +1×21+0×20+1×2-1+0×2-2 + 1×2-3 = 16 +0 +4 + 2 + 0 + 0.5 +0 +0.125 = 22.625 • 八进制数 • 127.21 = 1× 82 +2×81 + 7×80 + 2×8-1 + 1×8-2 = 64 + 16 + 7 + 0.25 + 0.15625 = 87.265625 • 十六进制数 • 1AF.C = 1 × 162 +A × 161 + F ×160 + C ×16-1 = 1×256 + 10×16 + 15 + 12×0.0625 = 256 + 160 +15 + 0.75= 431.75
十进制转化成 r 进制——取余、分离整数 • 整数部分:除 r取余,商0为止,首次取得的余数最右,依次从右至左排列。 • 小数部分:乘 r取整,自定精度,首次取得的整数最左,依次从左至右排列。
0.345 2 × 2 100 0 0.690 0 2 50 2 × 1 1.380 0 2 25 2 × 12 1 2 0 0.760 0 2 6 2 × 0 2 3 1 1 .520 1 2 1 2 × 1 0 1 1.040 继续 1. 十化二 小数部分 乘2取整 (B) . 1100100 01011 【例】100.345(D) = 整数部分 除2取余 分离整数 余数法
8 100 8 12 4 8 1 4 0 1 16 100 6 4 16 0 6 2. 十化八 【例】100 (D) = 除八取余 倒序排列 144 (O) 3. 十化十六 【例】100 (D)= 64 (H) 除16取余 倒序排列
二、八、十六进制数之间的转换 • 1. 整数转换 • 每一个八进制数码对应三位二进制数。 • 每一个十六进制数对应四位二进制数。 • 从右向左分组,不足为位可以补0。 • 2C1D(H) 10110000011101 (B) (16 2) 2 C 1 D • 17123(O) 1111001010011 (B) ( 8 2) 1 7 1 2 3
二、八、十六进制数之间的转换 01不足4位 后边补两个零 变为0100 ! • 2. 实数的转换 • 整数部分:从右向左进行分组。 • 小数部分:从左向右进行分组, • 转化成八进制三位一组,不足补零。 • 转化成十六进制四位一组,不足补零。 • 1101101111.11010100(B)=36F.D4(H) 3 6 F . D 4 =36F.d1(H) • 1101101110.110101 (B)=1556.65(O) 1 5 5 6 6 5 • (0011011011110111.11000100)2=(36F7.C4 )16
整型数的存储 1 . 机器数与真值 • 机器数:将一个数在机器中的存储形式(即编码)称为机器数。 • 在计算机中带符号整数是采用补码表示的 • 带符号数的最高位用来表示数的符号,一般用“0”表示“+”,用“1”表示“-”。 # of Bits --------- 8 16 Range------------------------------------- 0 255 0 65,535