CS1044 – Intro. To Programming in C++ Dr. Craig A. Struble.

Slides:



Advertisements
Similar presentations
Introduction to Programming in C++ John Galletly.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Overview of Programming and Problem Solving ROBERT REAVES.
CS 111: Introduction to Programming Midterm Exam NAME _________________ UIN __________________ 10/30/08 1.Who is our hero? 2.Why is this person our hero?
This set of slides is provided by the author of the textbook1 Introductory Topics (Continued) l Computer Components l Basic Control Structures l Problem.
COSC 120 Computer Programming
1 Chapter 1 Introduction to Object-Oriented Programming.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Wednesday, 9/4/02, Slide #1 1 CS 106 Intro to CS 1 Wednesday, 9/4/02  Today: Introduction, course information, and basic ideas of computers and programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30.
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.
CIS 260 Computer Programming I in C Prof. Timothy Arndt.
Intro to Programming CST JavaScript. Objectives Define software Identify the different types of software Differentiate the different types of programming.
Chapter 1 Introduction to Programming. Computer Hardware CPU Memory –Main or primary –Secondary or auxiliary Input device(s) Output device(s)
COS120 Software Development Using C++ AUBG Fall semester 2010
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Tools make jobs easier to do -A computer is a tool used by many professions A computer can do many different jobs because they are programmable - Machine.
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.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
High-Level Programming Languages: C++
CIS Computer Programming Logic
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CISC105 General Computer Science Class 1 – 6/5/2006.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
1 Overview of Programming and Problem Solving Chapter 1.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Overview of Programming and Problem Solving Textbook Chapter 1 1.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems/Headington.
Introducing C++ Programming Lecture 3 Dr. Hebbat Allah A. Elwishy Computer & IS Assistant Professor
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
1 8/31/05CS150 Introduction to Computer Science 1 Hello World!
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
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.
12/14/2016CS150 Introduction to Computer Science 1 Announcements  Website is up!   All lecture slides, assignments,
1 Overview of Programming Principles of Computers.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Introduction to Computer Programming using Fortran 77.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Software Engineering Algorithms, Compilers, & Lifecycle.
CHAPTER 1 OVERVIEW OF COMPUTER AND PROGRAMMING 1.1 Electronic Computer Then and Now 1.2 Computer Hardware 1.3 Computer Software 1.4 The Software Development.
Introduction to Computers and C++ Programming
Chapter Topics The Basics of a C++ Program Data Types
Engineering Problem Solving With C An Object Based Approach
Basic Elements of C++.
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Basic Elements of C++ Chapter 2.
CS110D: Programming Language I
CSCE Fall 2013 Prof. Jennifer L. Welch.
CS150 Introduction to Computer Science 1
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
CSCE Fall 2012 Prof. Jennifer L. Welch.
Understand the interaction between computer hardware and software
Chapter 2: Overview of C++
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

CS1044 – Intro. To Programming in C++ Dr. Craig A. Struble

Chapter 1 2 What is Programming? Planning or scheduling the performance of a task. Consciously thinking about each step Example: Accelerating in a car 1. Move right foot to gas pedal 2. Apply pressure to gas pedal with right foot 3. If speed is too high, apply less pressure. 4. If speed is too low, apply more pressure.

Chapter 1 3 Are Computers Intelligent? Do we really need to be involved in programming computers? – They have beaten world chess champions. – They help predict weather patterns. – They can perform arithmetic quickly. So, a computer has an IQ of _____.

Chapter 1 4 What Do We Have To Do? Computers cannot analyze problems and devise solutions. Humans (that’s us) must – Analyze and understand a problem; – Devise a sequence of steps to solve the problem; – Translate the steps into a computer language.

Chapter 1 5 Basic Computer Components Central Processing Unit (CPU) Arithmetic/Logic Unit Control Unit Memory Unit Input Devices Output Devices

Chapter 1 6 Central Processing Unit (CPU) Executes stored instructions Arithmetic/Logic Unit (ALU) – Performs arithmetic and logical operations Control Unit – Controls the other components – Guarantees instructions are executed in sequence

Chapter 1 7 Memory Unit Ordered sequence of cells or locations Stores instructions and data in binary Types of memory – Read-Only Memory (ROM) – Random Access Memory (RAM) Address

Chapter 1 8 Input and Output Devices Interaction with humans Gathers data (Input) Displays results (Output)

Chapter 1 9 What is Computer Programming? Planning or scheduling a sequence of steps for a computer to follow to perform a task. Basically, telling a computer what to do and how to do it.

Chapter 1 10 What Is A Computer Program? A sequence of steps to be performed by a computer. Expressed in a computer language.

Chapter 1 11 A Computer Program In C++ // This program converts miles to kilometers. // From Problem Solving, Abstraction, & Design Using C++ // by Frank L. Friedman and Elliot B. Koffman #include using namespace std; int main() { const float KM_PER_MILE = 1.609; // km in a mile float miles, // input: distance in miles kms; // output: distance in kilometers // Get the distance in miles cout << "Enter the distance in miles: "; cin >> miles; // Convert the distance to kilometers and display it. kms = KM_PER_MILE * miles; cout << "The distance in kilometers is " << kms << endl; return 0; }

Chapter 1 12 Computer Languages A set of – Symbols (punctuation), – Special words or keywords (vocabulary), – And rules (grammar) used to construct a computer program.

Chapter 1 13 Differences In Computer Languages Languages differ in – Size (or complexity) – Readability – Expressivity (or writability) – "Level" closeness to instructions for the CPU

Chapter 1 14 Machine Language Binary-coded instructions Used directly by the CPU Lowest level language Every program step is ultimately a machine language instruction Address Contents

Chapter 1 15 Assembly Language Each CPU instruction is labeled with a mnemonic. Very-low level language – Almost 1 to 1 correspondence with machine language Translated to machine language by an assembler. MnemonicInstruction ADD MUL X,10 ADD X,Y STO Z,20 SUB X,Z Sample Program

Chapter 1 16 High-Level Languages Closer to natural language Each step maps to several machine language instructions Provides support for abstractions – Easier to state and solve problems

Chapter 1 17 Examples of High-Level Languages LanguagePrimary Uses PascalLearning to program C++General purpose FORTRANScientific programming PERLWeb programming, text processing JavaWeb programming, application programming COBOLBusiness

Chapter 1 18 Basic Programming Language Structures Sequence – Execute steps or statements in the language one after another. Statement …

Chapter 1 19 Basic Programming Language Structures Selection (AKA branch or decision) – Selectively execute statements based on some condition being true or false. – IF condition THEN statement1 ELSE statement2 Condition Statement1 Statement2 … True False

Chapter 1 20 Basic Programming Language Structures Loop (AKA repetition or iteration) – Repeat a statement several times until a specified condition is false. – WHILE condition DO statement1 Condition Statement1 False True …

Chapter 1 21 Basic Programming Language Structures Subprogram (AKA procedure, function, method, or subroutine) – A collection of the previous structures that accomplishes some smaller task. SUBPROGRAM1 Accomplishes some small part of a larger task. …