Presentation is loading. Please wait.

Presentation is loading. Please wait.

BBS 514 - Yapısal Programlama (Structured Programming)1 BBS 514 Yapısal Programlama (Structured Programming)

Similar presentations


Presentation on theme: "BBS 514 - Yapısal Programlama (Structured Programming)1 BBS 514 Yapısal Programlama (Structured Programming)"— Presentation transcript:

1 BBS 514 - Yapısal Programlama (Structured Programming)1 BBS 514 Yapısal Programlama (Structured Programming)

2 BBS 514 - Yapısal Programlama (Structured Programming)2 Course Information –Instructor: Name: Prof. Dr. İlyas Çiçekli Office: Dept. Of Computer Engineering, Room 109 Tel: 297-7500 Ext. 144 Email: ilyas@cs.hacettepe.edu.tr Course Web Page: http://web.cs.hacettepe.edu.tr/~ilyas/BBS514 Text Book: Programming in ANSI C, Ram Kumar and Rakesh Agrawal, West Publishing Company, 1992.

3 BBS 514 - Yapısal Programlama (Structured Programming)3 Course Organization (Exams) One midterm, one final exam. Dates and times will be announced on the web and in class. Programming assignments Grading policy on course web page

4 BBS 514 - Yapısal Programlama (Structured Programming)4 Course Organization (Syllabus) Introduction to Course Algorithms Introduction to C Variables, Assignment Statement, Simple IO Decision Statements Repetition Statement Functions Arrays Pointers More on Arrays and Pointers Characters and Strings Structures File Processing Recursion

5 BBS 514 - Yapısal Programlama (Structured Programming)5 Computers

6 BBS 514 - Yapısal Programlama (Structured Programming)6 Computers A computer is a device capable of performing computations and making logical decisions at very fast speeds. First electronic digital computer was ENIAC. –built in 1946 at University of Pennsylvania –used to compute ballistic tables –it was very huge Since from the first computer, computers are getting smaller, but they are getting much powerful. They are widely used in many areas of society. –banking, scientific research, schools, airplanes, space program, etc.

7 BBS 514 - Yapısal Programlama (Structured Programming)7 Hardware & Software The set of instructions controls computers are known as computer programs (software). –programs and data –a program is a series of instructions The physical structure of the computer is called as hardware. –the physical, tangible parts of a computer –keyboard, monitor, disks, wires, chips, etc. A computer requires both hardware and software Each is essentially useless without the other

8 BBS 514 - Yapısal Programlama (Structured Programming)8 Hardware A modern computer consists of five main components and they are all parts of computer hardware: –Memory –Central Processing Unit (CPU) –Input Devices –Output Devices –Secondary Storage

9 BBS 514 - Yapısal Programlama (Structured Programming)9 CPU and Main Memory Central Processing Unit Main Memory Chip that executes program commands Intel Pentium 4 Sun ultraSPARC III Primary storage area for programs and data that are in active use Synonymous with RAM

10 BBS 514 - Yapısal Programlama (Structured Programming)10 Secondary Memory Devices Central Processing Unit Main Memory USB Disk Hard Disk Secondary memory devices provide long-term storage Information is moved between main memory and secondary memory as needed Hard disks Floppy disks ZIP disks Writable CDs Writable DVDs Tapes

11 BBS 514 - Yapısal Programlama (Structured Programming)11 Input / Output Devices Central Processing Unit Main Memory USB Disk Hard Disk Monitor Keyboard I/O devices facilitate user interaction Monitor screen Keyboard Mouse Joystick Bar code scanner Touch screen

12 BBS 514 - Yapısal Programlama (Structured Programming)12 Computer Organization (Memory) Memory Store information (data + instructions) A sequence of memory cells. –a byte is 8 bits –a bit is smallest unit (0 or 1) Store, retrieve, update –changing pattern of 0 and 1s in memory cells –copying these patterns into some internal registers Stored information in memory is volatile. Size of a memory of a typical PC system: 512MB, 1GB, 2GB –KB, MG, GB

13 BBS 514 - Yapısal Programlama (Structured Programming)13 Computer Organization (CPU) CPU (Central Processing Unit) Process and manipulate information stored in memory. It can be divided into two units: CU (Control Unit) and ALU (Arithmetic Logic Unit) CU coordinates activities of the computer and controls other devices of computer. ALU processes arithmetic and logical instructions.

14 BBS 514 - Yapısal Programlama (Structured Programming)14 Computer Organization (Input and Output Devices) Input and Output Devices Provide the interface between the user and the computer. Input devices are used to enter instructions or data by the user. Output devices are used to give results of computations. Input Devices: keyboard, mouse Output Devices: monitor, printer

15 BBS 514 - Yapısal Programlama (Structured Programming)15 Computer Organization (Secondary Storage) Secondary Storage Computers have limited main memory and information stored in main memory is volatile. i.e. when a computer is switched off, information in its main memory disappears. There are additional data storage unit, called secondary storage units. Data stored in these secondary storage units are permanent, i.e. data does not disappear when you switch off the computer. Some secondary storage units: –Floppy Disks –Hard Disks –Tape Drive –Optic Disk (CD Drive, DVD Drive) –Flash Disk (USB Disks)

16 BBS 514 - Yapısal Programlama (Structured Programming)16 SOFTWARE Operating System –Controls all machine activities –Provides the user interface to the computer. –manages resources such as CPU and memory –Widows 95, Widows 98, Solaris, Unix Application Program –generic form for all other kind of software –games, word processors, compilers Most operating systems and application programs have a graphical user interface (GUI) Windows XP –an operating system –uses a graphical user interface. –consists of windows –you point the mouse and click there, you start a program

17 BBS 514 - Yapısal Programlama (Structured Programming)17 File/Directory File contains a document and Directory contains files or other directories. You will be able to create files and directories a file can contain different types of information, and normally the extension of that file reflects the content of that file. –.doc : a word document –.c : A C program file –.exe : Executable file –.java : a java program –.class: a class file –.html: a hypertext file used to represent a web page

18 BBS 514 - Yapısal Programlama (Structured Programming)18 A Computer Specification Consider the following specification for a personal computer: –2.8 GHz Pentium 4 Processor –512 MB RAM –80 GB Hard Disk –48x CD-RW / DVD-ROM Combo Drive –17” Video Display with 1280 x 1024 resolution –56 Kb/s Modem What does it all mean?

19 BBS 514 - Yapısal Programlama (Structured Programming)19 Memory Main memory is divided into many memory locations (or cells) 9278 9279 9280 9281 9282 9283 9284 9285 9286 Each memory cell has a numeric address, which uniquely identifies it

20 BBS 514 - Yapısal Programlama (Structured Programming)20 Storing Information 9278 9279 9280 9281 9282 9283 9284 9285 9286 Large values are stored in consecutive memory locations10011010 Each memory cell stores a set number of bits (usually 8 bits, or one byte)

21 BBS 514 - Yapısal Programlama (Structured Programming)21 Storage Capacity Every memory device has a storage capacity, indicating the number of bytes it can hold Capacities are expressed in various units: KB2 10 = 1024 MB2 20 (over 1 million) GB2 30 (over 1 billion) TB2 40 (over 1 trillion) UnitSymbolNumber of Bytes kilobyte megabyte gigabyte terabyte

22 BBS 514 - Yapısal Programlama (Structured Programming)22 Memory Main memory is volatile - stored information is lost if the electric power is removed Secondary memory devices are nonvolatile Main memory and disks are direct access devices - information can be reached directly The terms direct access and random access often are used interchangeably A magnetic tape is a sequential access device since its data is arranged in a linear order - you must get by the intervening data in order to access other information

23 BBS 514 - Yapısal Programlama (Structured Programming)23 RAM vs. ROM RAM - Random Access Memory (direct access) ROM - Read-Only Memory The terms RAM and main memory are basically interchangeable ROM could be a set of memory chips, or a separate device, such as a CD ROM Both RAM and ROM are random (direct) access devices! RAM probably should be called Read-Write Memory

24 BBS 514 - Yapısal Programlama (Structured Programming)24 Compact Discs A CD-ROM is portable read-only memory A microscopic pit on a CD represents a binary 1 and a smooth area represents a binary 0 A low-intensity laser reflects strongly from a smooth area and weakly from a pit A CD-Recordable (CD-R) drive can be used to write information to a CD once A CD-Rewritable (CD-RW) can be erased and reused The speed of a CD drive indicates how fast (max) it can read and write information to a CD

25 BBS 514 - Yapısal Programlama (Structured Programming)25 DVDs A DVD is the same size as a CD, but can store much more information The format of a DVD stores more bits per square inch A CD can store 650 MB, while a standard DVD can store 4.7 GB –A double sided DVD can store 9.4 GB –Other advanced techniques can bring the capacity up to 17.0 GB Like CDs, there are DVD-R and DVD-RW discs

26 BBS 514 - Yapısal Programlama (Structured Programming)26 The Central Processing Unit A CPU is on a chip called a microprocessor It continuously follows the fetch-decode-execute cycle: fetch Retrieve an instruction from main memory decode Determine what the instruction is execute Carry out the instruction

27 BBS 514 - Yapısal Programlama (Structured Programming)27 The Central Processing Unit The CPU contains: Arithmetic / Logic Unit Registers Control Unit Small storage areas Performs calculations and makes decisions Coordinates processing steps

28 BBS 514 - Yapısal Programlama (Structured Programming)28 The Central Processing Unit The speed of a CPU is controlled by the system clock The system clock generates an electronic pulse at regular intervals The pulses coordinate the activities of the CPU The speed is usually measured in gigahertz (GHz)

29 BBS 514 - Yapısal Programlama (Structured Programming)29 Monitor The size of a monitor (17") is measured diagonally, like a television screen Most monitors these days have multimedia capabilities: text, graphics, video, etc. A monitor has a certain maximum resolution, indicating the number of picture elements, called pixels, that it can display (such as 1280 by 1024) High resolution (more pixels) produces sharper pictures

30 BBS 514 - Yapısal Programlama (Structured Programming)30 Modem Data transfer devices allow information to be sent and received between computers Many computers include a modulator-demodulator or modem, which allows information to be moved across a telephone line A data transfer device has a maximum data transfer rate A modem, for instance, may have a data transfer rate of 56,000 bits per second (bps)

31 BBS 514 - Yapısal Programlama (Structured Programming)31 Networks A network is two or more computers that are connected so that data and resources can be shared Most computers are connected to some kind of network Each computer has its own network address, which uniquely identifies it among the others A file server is a network computer dedicated to storing programs and data that are shared among network users

32 BBS 514 - Yapısal Programlama (Structured Programming)32 Network Connections Each computer in a network could be directly connected to every other computer in the network These are called point-to-point connections This technique is not practical for more than a few close machines Adding a computer requires a new communication line for each computer already in the network

33 BBS 514 - Yapısal Programlama (Structured Programming)33 Network Connections Most networks share a single communication line Adding a new computer to the network is relatively easy Network traffic must take turns using the line, which introduces delays Often information is broken down in parts, called packets, which are sent to the receiving machine and then reassembled

34 BBS 514 - Yapısal Programlama (Structured Programming)34 Local-Area Networks LAN A Local-Area Network (LAN) covers a small distance and a small number of computers A LAN often connects the machines in a single room or building

35 BBS 514 - Yapısal Programlama (Structured Programming)35 Wide-Area Networks LAN A Wide-Area Network (WAN) connects two or more LANs, often over long distances A LAN usually is owned by one organization, but a WAN often connects groups in different countries LAN

36 BBS 514 - Yapısal Programlama (Structured Programming)36 The Internet The Internet is a WAN which spans the entire planet The word Internet comes from the term internetworking It started as a United States government project, sponsored by the Advanced Research Projects Agency (ARPA) - originally it was called the ARPANET The Internet grew quickly throughout the 1980s and 90s

37 BBS 514 - Yapısal Programlama (Structured Programming)37 TCP/IP A protocol is a set of rules that determine how things communicate with each other The software which manages Internet communication follows a suite of protocols called TCP/IP The Internet Protocol (IP) determines the format of the information as it is transferred The Transmission Control Protocol (TCP) dictates how messages are reassembled and handles lost information

38 BBS 514 - Yapısal Programlama (Structured Programming)38 IP and Internet Addresses Each computer on the Internet has a unique IP address, such as: 204.192.116.2 Most computers also have a unique Internet name, which also is referred to as an Internet address: spencer.villanova.edu kant.gestalt-llc.com The first part indicates a particular computer ( spencer ) The rest is the domain name, indicating the organization ( villanova.edu )

39 BBS 514 - Yapısal Programlama (Structured Programming)39 Domain Names The last part of a domain name, called a top-level domain (TLD), indicates the type of organization: edu com org net - educational institution - commercial entity - non-profit organization - network-based organization Sometimes the suffix indicates the country: New TLDs have recently been added: biz, info, tv, name uk au ca se - United Kingdom - Australia - Canada - Sweden

40 BBS 514 - Yapısal Programlama (Structured Programming)40 Domain Names A domain name can have several parts Unique domain names mean that multiple sites can have individual computers with the same local name When used, an Internet address is translated to an IP address by software called the Domain Name System (DNS) There is no one-to-one correspondence between the sections of an IP address and the sections of an Internet address

41 BBS 514 - Yapısal Programlama (Structured Programming)41 The World Wide Web The World Wide Web allows many different types of information to be accessed using a common interface A browser is a program which accesses and presents information –text, graphics, video, sound, audio, executable programs A Web document usually contains links to other Web documents, creating a hypermedia environment The term Web comes from the fact that information is not organized in a linear fashion

42 BBS 514 - Yapısal Programlama (Structured Programming)42 The World Wide Web Web documents are often defined using the HyperText Markup Language (HTML) Information on the Web is found using a Uniform Resource Locator (URL): http://www.lycos.com http://www.villanova.edu/webinfo/domains.html ftp://java.sun.com/applets/animation.zip A URL indicates a protocol (http), a domain, and possibly specific documents

43 BBS 514 - Yapısal Programlama (Structured Programming)43 Software The set of instructions controls computers are known as computer programs (software). a software is a series of instructions In this course, we will how to write computer programs using C programming language. Before, we start to learn C programming language we will talk about: –ALGORITHMS: a sequence of instructions to solve a problem


Download ppt "BBS 514 - Yapısal Programlama (Structured Programming)1 BBS 514 Yapısal Programlama (Structured Programming)"

Similar presentations


Ads by Google