chapter 1 introduction to computers and programming l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Chapter 1. Introduction to Computers and Programming PowerPoint Presentation
Download Presentation
Chapter 1. Introduction to Computers and Programming

Loading in 2 Seconds...

play fullscreen
1 / 23

Chapter 1. Introduction to Computers and Programming - PowerPoint PPT Presentation


  • 350 Views
  • Uploaded on

Chapter 1. Introduction to Computers and Programming. 1.1 Why Program?. Computers can do many different jobs because they are programmable. 1.2 Computer Systems: Hardware and Software.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Chapter 1. Introduction to Computers and Programming' - israel


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
1 1 why program
1.1 Why Program?
  • Computers can do many different jobs because they are programmable.
1 2 computer systems hardware and software
1.2 Computer Systems: Hardware and Software
  • All computer systems consist of similar hardware devices and software components. This section provides an overview of standard computer hardware and software organization.
hardware
Hardware
  • The CPU
  • Main Memory
  • Secondary Storage
  • Input Devices
  • Output Devices
figure 1 1
Figure 1.1

Central

Processing

Unit

Input

Device

Output

Device

Main

Memory

Output

Device

figure 1 2
Figure 1.2

Instruction

(Input)

Arithmetic and Logic Unit

Result

(Output)

Control Unit

software
Software
  • Operating Systems
    • Single tasking
    • Multi-tasking
  • Application Software
1 3 programs and programming languages
1.3 Programs and Programming Languages
  • What is a program?
    • A set of instructions a computer follows in order to perform a task. A programming language is a special language used to write computer programs.
program 1 1
Program 1-1

// This program calculates the user’s pay.

#include <iostream.h>

void main(void)

{

float hours, rate, pay;

cout << “How many hours did you work? ”;

cin >> hours;

cout << “How much do you get paid per hour? ”;

cin >> rate;

pay = hours * rate;

cout << “You have earned $” << pay << endl;

}

program output
Program Output

How many hours did you work? 10

How much do you get paid per hour? 15

You have earned $150

programming languages
Programming Languages
  • Figure 1-4

High level

(Close to Human Language)

Low level

(Machine Language)

1 4 what is a program made of
1.4 What is a Program Made of?
  • There are certain elements that are common to all programming languages.
    • Key Words
    • Programmer-Defined Symbols
    • Operators
    • Punctuation
lines and statements
Lines and Statements

cout << “How many hours did you work?”;

variables
Variables
  • A storage location in the computer’s memory for holding a piece of information.
  • Symbolic names that represent locations in the computer’s random-access memory.
variable declarations
Variable Declarations
  • Two types of information: numbers and characters
  • Numbers may be integers or floating-point numbers
  • The statement below creates three variables in memory named hours, rate, and pay that each can store a floating point number

float hours, rate, pay;

1 5 input processing and output
1.5 Input, Processing, and Output
  • Input:

cin >> hours;

  • Processing:

pay = hours * rate;

  • Output

cout<<“You have earned $”<<pay;

1 6 the programming process
1.6 The Programming Process
  • The programming process consists of several steps, which include design, creation, testing and debugging activities.
designing and creating a program
Designing and Creating a Program

1. Clearly define what the program is to do

2. Visualize the program running on the computer.

3. Design a flowchart or hierarchy chart

4. Check the flowchart or hierarchy chart for logical errors.

slide21
5. Write a pseudocode version of the program.

6. Check the pseudocode for errors.

7. Write the actual program on paper.

8. Desk-check the program for errors.

9. Enter the code and compile it.

10. Correct any errors found during compilation. Repeat steps 9 and 10 as many times as necessary.

slide22
11. Run the program with test data for input.
  • Correct any errors found while running the program. Repeat steps 9 through 12 as many times as necessary.
  • Validate the results of the program.
1 7 procedural and object oriented programming
1.7 Procedural and Object-Oriented Programming
  • Procedural programming and object-oriented programming are two ways of thinking about software development and program design.