Week 1 Lecture Material Penn State University CMPSC 201 – C++ Programming for Engineers Original class notes from Dough Hogan,

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
FIRST COURSE Essential Computer Concepts. New Perspectives on Microsoft Office 2007: Windows XP Edition 2 Objectives Compare the types of computers Describe.
Hardware. Basic Computer System Central Processing Unit Input Devices Output Devices Backing Storage Devices.
Computer Hardware Introduction. Computer System Components Input Keyboard, Mouse, Camera, Touch Pad Processing CPU Output Monitor, Printer Storage Floppy,
COSC 120 Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Computers
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
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.
CS102 Introduction to Computer Programming
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.
Computer Systems. Note to the student Please make brief notes on the following computer hardware + software components After each section research the.
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.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
Tom Allen Computer Science Department Trinity University.
CSCI 125 & 161 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk.
Topics Introduction Hardware and Software How Computers Store Data
Learning Targets Identify the external parts of the computer Identify examples of input devices Identify examples of output devices Define basic computer.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Introduction to Computers
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
Introduction to Computers
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
1 Introduction to Computers Lect 1 Won’t tell you much you don’t know. (Misleading– the course gets more conceptual as we create webpages.) Will go into.
Introduction to the Computer System. What is a computer ? A computer is an electronic device that can accept data and instruction, process them or store.
Computer Parts. Two Basic Parts Hardware & Software.
Fundamentals. Main Hardware Components Central Processing Unit (CPU) Main Memory (random access memory or RAM) Auxiliary Storage Input Devices Output.
Introduction to Computer Systems and the Java Programming Language.
Computer Science Theory & Introduction Week 1 Lecture Material Doug Hogan Penn State University CMPSC 201 – C++ Programming for Engineers.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
IT Groundwork ICS3UC - Unit 1 Hardware. Overview of Computer System.
Computer Science Theory & Introduction Week 1 Lecture Material – F'13 Revision Doug Hogan Penn State University CMPSC 201 – C++ Programming for Engineers.
CSCI-100 Introduction to Computing Hardware Part I.
1 st Semester Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND.
Computer Organization. The digital computer is a digital system that performs various computational tasks Digital computer use binary number system which.
Beginning Snapshots Chapter 0. C++ An Introduction to Computing, 3rd ed. 2 Objectives Give an overview of computer science Show its breadth Provide context.
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.
The Computer System CS 103: Computers and Application Software.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Some Computer Science Conceptual Background Material Doug Hogan This version for UIC Spring 2016 CS 107.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software.
Introduction to Computers Lecture 1.1 Doug Hogan, Penn State University CMPSC 100 – Computer Fundamentals and Applications.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming
Java Programming: From the Ground Up
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Computer Hardware Introduction.
Introduction to Computers
Chapter 1: Introduction to Computers and Programming
Introduction to Computers
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

Week 1 Lecture Material Penn State University CMPSC 201 – C++ Programming for Engineers Original class notes from Dough Hogan, Computer Science Theory & Introduction

Hardware vs. Software Hardware : physical components of a computer system essentially, things you can touch input, output, storage devices Software : A collection of computer programs and its related data that provides the instructions telling a computer what to do! In contrast to hardware, software "cannot be touched“! 0s and 1s : Owing to its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used internally by all modern computers.

Hardware vs. Software Application Software System Software Hardware

Components of a Computer Central processing unit (CPU) Memory Input devices Output devices Storage devices

Central Processing Unit (CPU) Basic job: handle processing of instructions What’s an instruction? Two parts: Control Unit (CU) Arithmetic and Logic Unit (ALU)

The ALU Built up from digital logic gates AND OR NOT most primitive level

Memory Holds programs that are currently running and the data being used by those programs. Two categories: Read-only memory (ROM) can only read data Random-access memory (RAM) can read and write information primary storage - computer’s main memory volatile

Sequential Access vs. Random Access Sequential Access: must access each location in memory in order Random Access: can access memory locations using addresses, in any order Speed implications? Track 1 Track 2

Memory: sizes base unit: 1 bit = binary digit, 0 or 1 8 bits = 1 byte (B) 1000 bytes ≈ 1 kilobyte (KB) 1000 KB ≈ 1,000,000 B ≈ 1 megabyte (MB) 1000 MB ≈ 1,000,000,000 B ≈ 1 gigabyte (GB)

Storage Devices Floppy disk 3.5 inches, 1.44 MB Hard disk typically sizes in GB Compact disc (CD) MB CD-ROM: read-only memory CD-R: recordable CD-RW: rewritable

More Storage Devices Digital Versitale/Video Disc (DVD) 4.7 GB Flash drives varies Zip disks and tape drives varies

Input Devices mouse keyboard scanner camera microphone

Output Devices monitor cathode ray tube (CRT) liquid crystal display (LCD) printer speakers

Software Overview System software Controls basic operations of computer The operating system manages memory, files, application software File management tasks – deleting, etc.

Software Overview Application software Not essential to system running Enables you to perform specific tasks Ex: Office software Web browsers Media players Games

Algorithms and Languages

Algorithms An algorithm is a set of instructions to solve a problem. Think recipes! Many algorithms may solve the same problem! How do we choose between them? The answer is that: Different Algorithms differ in the time and the space they take to run! we choose the most efficient algorithm according to our resources! (space and time) Example: You may have a lot of memory and your only concern is how fast the program runs, or the other way around.

Programming Paradigms/Models Procedural Programming: specify steps to solve problem, use procedures to implement those steps Procedures are called methods in C++ Object-Oriented Programming (OOP): create objects to model real-world entities. e.g. an employee object As in real world each object has its own Information: (represented by data types) Behaviors: (implemented by methods/procedures) Objects can interact, as they do in real world Event-Driven Programming: create methods that respond to events like mouse clicks, key presses, etc. Others: Functional, logic, etc.

Compiling Process Source Code (C++) Object Code Executable Program Object Code from Libraries compilerlinker Compiler is a software that transforms a source code written in one programming language into a program in another language (usually machine language, a language than can be executed by CPU) Code in machine language

linker :A program that takes two or more object files generated by a compiler and combines them into a single executable program. Source Code (C++) Object Code Executable Program Object Code from Libraries compilerlinker

Library has been complied before!, it won’t need to be compiled every time. Object Code from Libraries Source Code of library (C++) compiler

Compiled vs. Interpreted Languages Interpreted Language Requires software called an interpreter to run the code Code is checked for errors as it runs (if erroneous code: does the best it can…) Examples: HTML, JavaScript, PHP Compiled Language Requires software called a compiler to translate the program into (usually) an executable program with machine language Syntax errors will be found during compilation code will be syntax-error free while executing (running) Examples: C, C++, Pascal, FORTRAN, BASIC

Errors Syntax Errors Much like using incorrect punctuation or grammar in English Compiler reports syntax errors; program won’t run until they’re resolved Logic Errors Program doesn’t solve the problem correctly It May be correct syntactically, but it is not doing what is supposed to do (according to specification of program)! Runtime Errors Errors that occur while the program is running, e.g. problems accessing memory, divide by zero

Abstraction Abstraction is a fundamental concept to CS Principle of ignoring details, so that by focusing on more general concepts we are able to use complex devices Focusing on the WHAT, rather than HOW Example: Abstract of a paper! Example: Your report template!

Levels of Abstraction 0. Digital Logic 1. Machine Language A system of instructions, that are executable directly by the CPU. Every CPU has an instruction set architecture (ISA) of its own! 2. Operating System 3. Low-Level Language Low refers to small or no amount of abstraction from machine language. e.g. Assembly language 4. High-Level Language High refers to strong abstraction from the details of the CPU design Uses natural language elements, thus it’s easier to understand 5. Application Software

Binary Numbers Use two symbols: 0 and 1 to represents numbers Base 2 Compare with decimal number system Uses symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 to represents numbers Base 10 At the lowest level of abstraction, everything in a computer is expressed in binary.

Binary Numbers, ctd

Binary Numbers, ctd _____________________ _____________________

Convert Vs. Decimal

Other Number Systems Any positive integer could be the base of a number system. (Big topic in number theory.) Others used in computer science: Octal: Base 8 Hexadecimal: Base 16 New symbols A, B, C, D, E, F

Example of machine language instructions At the lowest level of abstraction, everything in a computer is expressed in binary. This is an example of an ‘Add’ instruction: Couple of more examples of machine language instructions:

Hello World Example in Assembly Language.model small.stack.data message db "Hello world, I'm learning Assembly !!!", "$".code main proc mov ax,seg message mov ds,ax mov ah,09 lea dx,message int 21h mov ax,4c00h int 21h min endp enad main

ASCII Every character on a computer -- letters, digits, symbols, etc. -- is represented by a numeric code behind the scenes. ASCII is a character-encoding scheme based on the ordering of the English alphabet Short for American Standard Code for Information Interchange. Most modern character-encoding schemes are based on ASCII, though they support many more characters than does ASCII. We’ll learn more in lab…

Moor’s Law

# Transistors on a Processor ProcessorDateNumber of Transistors , , , , , , DX19891,180,000 Pentium19933,100,000 Pentium II19977,500,000 Pentium III199924,000,000 Pentium ,000,000 Data for Intel processors: Data from Section 4.1 of : Yates, Daniel S., and David S. Moore and Daren S. Starnes. The Practice of Statistics. 2nd Ed. New York: Freeman, 2003.

A Graphical View Graph from Intel's web site ( Retrieved 9/24/2006http:// Pay attention to the units on the axes…

Moore’s Law Prediction from Gordon Moore of Intel in Implication: The speed of processors doubles roughly every 12 to 18 months. Can this go on forever?