1 / 12

Computers and Programming

Computers and Programming. Bina Ramamurthy. 127 Bell Hall bina@cs.buffalo.edu. Introduction. A computer executes the solution designed for a problem. A program expresses the solution in a form that a computer can understand.

Download Presentation

Computers and Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computers and Programming Bina Ramamurthy 127 Bell Hall bina@cs.buffalo.edu

  2. Introduction • A computer executes the solution designed for a problem. A program expresses the solution in a form that a computer can understand. • In this discussion we will look at the basic components of a computer, the programming environment, the system support, and program development phases.

  3. Topics for discussion • Basic components of a computer • Operating systems • High level language • Processing a program • Software development stages • Example

  4. Basic Components of a digital computer CONTROL INPUT OUTPUT PROCESSOR MEMORY DATA CONTROL

  5. ..Components ... • Processor = Arithmetic Logic Unit (ALU) • ALU + Control = CPU = Central Processing Unit • Ex: PowerPc 604, Intel Pentium, Motorola 68xxx • Ex: Input : Mouse Output : laser printer • Memory : main memory (RAM) • Secondary memory : Floppy disk, hard disk.

  6. Operating systems • Provides user interface • Resource management • Security and protection • Provides utility programs and libraries : Editor, math library • Example : unix , MS-DOs, windows-95

  7. High level language • The hardware underlying a computer communicates and computes in binary code called machine code. • But in order for the humans to effectively communicate the solutions to a computer we need a language that is closer to human language : High Level language (HLL). ex: C++ • Problem : HLL -->machine code • Solution: A translation mechanism : Compiler or an interpreter

  8. Steps in software development • Problem analysis • Clear understanding of the problem • identify problem’s input, output, requirements and constraints. • Solution design • Class design : Identify the classes of objects required by the problem and draw relationship among these. • Algorithm design: Stepwise solution to carry out the functionality of the classes.

  9. Steps in software development (contd.) • Documentation • Provide information for use and maintenance of the software. Provide an example that gives input and output. • Implementation • Code the algorithms into a programs using a HLL. • Debugging • Compile and execute the software. Remove any errors. • Testing • Execute with various test data and make sure the software works as expected.

  10. Example (non-computer problem) Problem 1: You are on your way to visit a friend in Chicago. You are driving in downtown Chicago and are lost. Solve this problem.

  11. Example (computer problem) • Problem 2: Count the number of times the letter ‘a’ occurs in a piece of text. • Solution: • 1. Initialize Acounter = 0; // Assignment - memory 2. Input a character from input. //input 3. If it is an “a” then // selection Increment Acounter; // arithmetic - memory 4. Repeat steps 2 - 3 until end of input. //repetition 5. Output Acounter. // output 6. Exit

More Related