CIS 260 Computer Programming I in C Prof. Timothy Arndt

Preview:

Citation preview

CIS 260 Computer Programming I in C

Prof. Timothy Arndt

Office location: BU 331

Office hours: 12:30pm – 2:30pm TTH, 7:00pm-8:00pm TH

Office Phone: 687-4779

E-Mail: arndt@cis.csuohio.edu

Course Objectives

Develop algorithmic problem solving skills Understand modern software engineering

techniques for the design of program solutions

Learn the ANSI C programming language

Course Overview

Introduction to computers & programming Problem solving; variables; expressions,

printf Top down design; functions Selection structures; if and switch

statements Repetition and loop statements

Course Overview

Modular programming Data types and operators Arrays Strings Structure and Union Types File Processing Pointers and dynamic memory allocation Stacks, Queues, Binary Trees

Texts

Problem Solving and Program Design in C, Hanly and Koffman, Addison-Wesley, 1996.

History of Electronic Computers

First electronic computer built in late 1930’s by Atanasoff and Berry

First general purpose computer called ENIAC, 1946

These computers used vacuum tubes. Later computers used integrated circuits, LSI, VLSI

Categorization of Computers

Microcomputers Workstations Mainframes Supercomputers Minicomputers Servers

Computer Hardware

Main memory Secondary memory Central processing unit Input devices

– Keyboards

– Mouses

Output devices– Monitors

– Printers

Memory

The memory of a computer is an ordered sequence of storage locations called memory cells

Each memory cell has a unique address The data stored in a cell are called the

contents of the cell A cell may contain diverse types of data -

numbers, characters, or program data

Bytes and bits

A memory cell is a grouping of smaller units called bytes.

A byte is the amount of storage required to store a single character

A bit (binary digit) is the smallest unit a computer can deal with

A bit is either 0 or 1

Storage and Retrieval of Information in Memory To store a value in a memory cell, the

computer sets each bit of the cell to 0 or 1, destroying the previous values

To retrieve a value from a memory cell, the computer copies the contents of the cell to another area

Main memory

Random access memory (RAM) is volatile (data is lost when the computer is turned off).

Read only memory (ROM) is non-volatile and is often used to store the startup instructions of the computer

Cache memory is fast RAM

Secondary Storage Devices

Disk drives are read-write random access devices with files organized in directories and subdirectories– Hard disks– Floppy disks

CD-ROM drives are (usually) read-only random access devices

Tape drives are read-write sequential access devices

Central Processing Unit

Coordinates all computer operations Performs arithmetic and logical operations

on data Stored programs are executed in a cycle of

instruction fetch, instruction decode, data fetch, instruction execute, result store sequences

Input/Output Devices

I/O devices allow us to enter data for a computation and observe the results of the computation

Keyboard Mouse Monitor Printer

Programming Languages

Machine languages are the native languages of the computer and are coded as strings of 0’s and 1’s

Assembly languages substitute symbolic names for strings of 0’s and 1’s

High-Level Language instructions correspond to sequences of assembly language instructions and are easier to read/write

Relationship Between High-Level and Machine Languages In order to be executed by a computer, a

program written in a high-level language (source program) must be translated to machine language

The translator is called a compiler The resulting program is called an object

program

Operating System

The software which controls the operation of a computer is called the operating system

Operating systems may have graphical interfaces (GUIs) command line interfaces (CLIs) or both

Software Development Method

Specify the problem requirements Analyze the problem Design the algorithm to solve the problem Implement the algorithm Test and verify the completed algorithm Maintain and update the program

Case Study: Miles to Kilometers

Analyze the problem Problem input: distance in miles Problem output: distance in kilometers Additional constraints on the solution?

Design

Algorithm – Get the distance in miles– Convert the distance to kilometers– Display the distance in kilometers

Refine the algorithm– The distance in kilometers is 1.609 times the

distance in miles

Recommended