Chapter 1 Introduction to Computers and C++ Programming.

Slides:



Advertisements
Similar presentations
Lecture 1: Overview of Computers & Programming
Advertisements

Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
COSC 120 Computer Programming
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Computers: Tools for an Information Age
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Introduction to Computers and Programming
CS102 Introduction to Computer Programming
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
CSE 1340 Introduction to Computing Concepts Class 2.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction Chapter 1. 1 History of Computers Development of computers began with many early inventions: The abacus helped early societies perform computations.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
Computer Concepts 2014 Chapter 12 Computer Programming.
Visual C++ Programming: Concepts and Projects
Chapter 1: An Overview of Computers and Programming Languages
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
1 Chapter 13 Understanding Computers, 11 th Edition 13 Program Development and Programming Languages TODAY AND TOMORROW 11 th Edition CHAPTER.
1 Problem Solving with C++ The Object of Programming Walter Savitch Chapter 1 Introduction to Computers and C++ Programming Slides by David B. Teague,
What is computer hardware? Computer hardware are the physical components of the computer.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
The Hashemite University Computer Engineering Department
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Introduction to Computer Programming using Fortran 77.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 1 An Introduction to Visual Basic.NET and Program Design.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Chapter 1: Introduction to Computers and Programming
Chapter 1: An Overview of Computers and Programming Languages
Lecture 1: Introduction to JAVA
DDC 1023 – Programming Technique
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
An Introduction to Visual Basic .NET and Program Design
Chapter 1: Introduction to Computers and Programming
Computer Science I CSC 135.
VISUAL BASIC – CHAPTER ONE NOTES An Introduction to Visual Basic
Chapter 1 Introduction(1.1)
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Chapter 1 Introduction to Computers and C++ Programming

Introduction A program is a step-by-step series of instructions for a computer Programming is the process of writing these instructions Programmers, or developers, design and write programs using a programming language or development tool C++ is a programming language that provides the structure for efficient and economical programs

Programming a Computer Companies need developers to build general application software packages Custom applications are built for specific needs Existing programs need maintenance and upgrades New applications will be needed due to emerging technologies

Programmers follow a general methodology called the program development cycle to structure the development process. The phases of the cycle are Analyze the requirements Design the solution Validate the design Implement the design Test the solution Document the solution

Phase 1 – Analyze Requirements Verify that the requirements are clear and complete Evaluate the problem to determine that it is solvable using a program List the required input and output data Determine whether the input data is available for testing

Phase 1 – Analyze Requirements Ensure that a solution, or algorithm, can be developed with the information provided in the requirements Verify the user interface specifications

Phase 2 – Design Solution Develop a logical model that illustrates the sequence of steps you will take to solve the problem Use design tools such as storyboards, object structure diagrams, flowcharts, and pseudocode to outline the logic of the program An algorithm is a sequence of precise instructions that leads to a solution  Example: Determine how many times a name occurs in a list of names

Example: Determine how many times a name occurs in a list of names

BREAK

Example: Determine how many times a name occurs in a list of names 1. Get list of names 2. Get search name 3. Establish counter, set to zero 4. For each name in list: 1. Compare name in list to search name 2. If list name = search name, increment counter by one 5. Answer is the number indicated by the counter

Phase 2 – Design Solution Storyboards are sketches of the user interface

Phase 2 – Design Solution Flowcharts graphically represent the logic used to develop an algorithm Control structures allow the programmer to specify the code that will execute only if a condition is met Flowcharts use pseudocode, English, or mathematical notation inside symbols to represent the steps of a solution

Phase 2 – Design Solution Pseudocode is an English representation of how the program code should be written

Phase 3 – Validate Design The programmer steps through the solution with test data The user agrees that the program design solves the problem put forth in the requirements The user verifies that the initial requirements document contains all necessary requirements

Phase 4 – Implement Design Write the code that translates the design into a program Create the user interface Create comments within the code that explains the purpose of the code Test the code as it is written Test related code

Phase 4 – Implement Design

Phase 5 – Test Solution Create a test plan with test cases of sample input data and expected output Perform integration testing to ensure that components interact correctly Test boundary values Document any problems  If results are unsatisfactory, a new iteration of the development cycle begins

Phase 6 – Document Solution Requirements documents, program design documents, user interface documents, and documentation of the code Test cases and proof of successful completion of testing Program code should be archived electronically

BREAK gliffy

Object-Oriented Programming and Design Object-oriented programming  Data and the code that operates on the data are packaged into a single unit called an object Object-oriented design  Identifies how objects interact with each other to solve a problem

Objects Class  Implementation of an object or set of objects with a common structure and behavior Class diagram  A tool displaying a hierarchy of classes, including superclasses and subclasses Instance  A specific occurrence of an object Attributes  The properties of an individual object Method/function  The code of an operation on the data of an object

Operations Message  The activation of an operation through naming the object and the operation to be performed on the object Trigger  Impetus for a sent message Event  The process of a trigger sending a message that results in an operation

Event Diagrams and UML Graphically represents relationships among event and operations Useful for designing event-driven programs

Encapsulation The process of hiding the implementation details of an object from its user The user is shielded from the system’s complexity Information hiding provides access to an object only through its messages Objects can be modified without requiring application modification

Inheritance An efficient way to reuse code by defining a subclass as an extension of another class The subclass inherits all the data and functions of the superclass The subclass has at least one attribute or method that differs from its superclass

Polymorphism Allows an instruction to be given to an object using a generalized command The same command will obtain different results depending on the object receiving the command The specific actions internal to the object are encapsulated from the user

Abstraction Simplifies complex reality by modeling classes appropriate to the problem Works at most appropriate level of inheritance for a given aspect of the problem Abstraction is also achieved through composition (car)

BREAK

Computer Hardware Computer hardware are the physical components of the computer.

Input/Output Devices Input/Output devices provide communication between user and hardware.  Input Devices Keyboard Mouse Scanner  Output Devices Monitor Speakers Printer

Processors and Memory Central Processing Unit (CPU)  Performs basic functions, millions and billions of times per second (brains of the computer) Random-Access Memory  Stores data used by the CPU (before and after processing)

Data Storage Data storage uses a variety of media. Capacity is measured in bits and bytes:  A bit represents the on or off state of a transistor (symbolized by a 1 or a 0).  A byte is eight bits.  A kilobyte is 2 10 or 1,024 bytes.  A megabyte is 1,048,576 bytes.

Hard Drives The hard drive is the primary storage device in a computer. Hard drives are:  Long term, rewritable storage  Large capacity  Inexpensive  Fixed media (relatively difficult to move from one computer to another)

Removable Media Some storage devices are more portable:  CD/DVD Medium capacity Inexpensive Easy to transport from one computer to another  Flash, Zip, USB drives Differing capacities Differing price per MB

Computer Software Software can be divided into two categories:  Systems software includes operating systems, compilers, and utilities.  Application software runs on top of an operating system.

What is an operating system? An operating system (OS) manages the hardware and software on a computer system. An OS:  Manages memory and hardware resources  Allocates resources to applications  Provides a consistent interface for applications

Operating Systems UNIX/Linux  Multiuser OS  Multitasking  Runs on many types of hardware  Modular tools Mac OS  First mainstream graphical user interface  Icons (pictures) and mouse replaced command line interface DOS/Windows  DOS gained popularity with first PCs  Windows provided graphical interface to DOS  Windows later separated itself from DOS underpinnings

Low-Level Languages Low-level programming languages use simple commands to communicate with the CPU:  Machine language (most basic language of the CPU)  Assembly language (human readable, but close to machine language)

High-Level Languages High-level languages can be procedural or object-oriented:  Procedural languages use a step-by-step process to solve a problem. Basic, Pascal, C  Object-oriented languages model problems using objects that correspond to real-world counterparts. Smalltalk, C++, Java

Origins of C++ Derived from C, which was derived from B (short for BCPL), developed in AT&T Bell Laboratories Why ++? Early 1980’s Most of C is a subset of C++

BREAK

Parts of a Program User Programmer Variable Declarations Variables Integer Statements (executable statements) cin and cout /n Line breaks and spacing include directive int main() return statement Compiling and running a program – what does a compiler do? **Test program

Testing and Debugging bug debugging Kinds of Errors:  Syntax error – compile time error (this program won’t run at all) – you’ve broken a rule of the language  Semantic – compile time error – you’ve changed the meaning of some word in your code  Run-time error – program compiles fine, and initially runs, but at some point an error is thrown and the program stops running  Logic error – program compiles fine, runs fine (no error is thrown throughout execution of the program), BUT the program doesn’t behave as it was meant to  System – software isn’t installed correctly Error message vs. warning message