CMPT 120 Introduction to Computer Science and Programming I Chris Schmidt.

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 1 Engineering Problem Solving.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
COMP6005 An Introduction to Computing Session Two: Computer Hardware.
Using Computers CS French Chapter 1.
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
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.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Computer Hardware.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
Computers & Logic An Overview. Hardware Hardware is the equipment, or the devices, associated with a computer. For a computer to be useful, however, it.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
CS102 Introduction to Computer Programming
Introduction to Computers and Python. What is a Computer? Computer- a device capable of performing computations and making logical decisions at speeds.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
INTRODUCTION TO COMPUTER PROGRAMMING itc-314 LECTURE 01.
Chapter 1 Engineering Problem Solving 1. Hardware and Software 2 A computer is a machine designed to perform operations specified with a set of instructions.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs.
CISC105 General Computer Science Class 1 – 6/5/2006.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
EG280 Computer Science for Engineers Fundamental Concepts Chapter 1.
Intro to Computers Computer Applications. What is a Computer? Initially the term computer referred to an individual whose job it was to perform mathematical.
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
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 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Chapter 1 09/04/13. Change Your Password  The command is: passwd In the lab first do : ssh -Y onyx  You will have to see me to change it, if you forget.
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,
Senem KUMOVA METİN // Fall CS 115 Introduction to Programming Introduction to Computing.
Computer Fundamentals MSCH 233 Lecture 1. What is a computer? A computer is an electronic machine which can accept data in a certain form, process the.
Ch 1 - Introduction to Computers and Programming Hardware Terminology Main Memory Auxiliary Memory Drives Writing Algorithms Using Pseudocode Programming.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Introduction To Computers
CS 177 Recitation Week 1 – Intro to Java. Questions?
Chapter 1 An Overview of Computers and Programming Languages.
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.
What’s a Computer?. The Basics A computer is a machine that manipulates data based on a list of instructions called a program.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
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.
Chapter 1: Introduction to Computers and Programming
Lecture 1b- Introduction
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving With C An Object Based Approach
Chapter 1: An Overview of Computers and Programming Languages
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Chapter 1: Introduction to Computers and Programming
CS190/295 Programming in Python for Life Sciences: Lecture 1
Computer Science I CSC 135.
Engineering 1020 Introduction to Programming
Introduction CSC 111.
15-110: Principles of Computing
Programming language translators
Computer Electronic device Accepts data - input
ICS103 Programming in C 1: Overview of Computers And Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

CMPT 120 Introduction to Computer Science and Programming I Chris Schmidt

CMPT 120 What will you learn? What will you learn? Basic concepts of Computing Science Basic concepts of Computing Science How computers store some types of data How computers store some types of data Algorithms (methods of solving problems) Algorithms (methods of solving problems) Data Structures (how to store complex data) Data Structures (how to store complex data) How to analyze and compare algorithms How to analyze and compare algorithms How to write programs in Python How to write programs in Python

Computing Science Comput-ing Science Comput-ing Science The majority of the time we aren’t concerned with the computer itself (hardware) The majority of the time we aren’t concerned with the computer itself (hardware) The main concern is the creation, analysis, and application of algorithms The main concern is the creation, analysis, and application of algorithms Hard to pin down a good definition Hard to pin down a good definition

Computing Science Computing Science is an extremely diverse field ranging from the completely theoretical to the very practical Computing Science is an extremely diverse field ranging from the completely theoretical to the very practical Logic, Complexity and Computability, Database Management, Artificial Intelligence, Human-Computer Interaction, Graphics, Natural Language Processing, Operating Systems, Programming Languages, Networking, Bioinformatics, Computer Architecture, Software Engineering Logic, Complexity and Computability, Database Management, Artificial Intelligence, Human-Computer Interaction, Graphics, Natural Language Processing, Operating Systems, Programming Languages, Networking, Bioinformatics, Computer Architecture, Software Engineering

The Basics Hardware Hardware Physical equipment (processor, monitor, keyboard, printer…) Physical equipment (processor, monitor, keyboard, printer…) If you can touch it, it’s hardware If you can touch it, it’s hardware Software Software Programs (sets of instructions) that run on the hardware Programs (sets of instructions) that run on the hardware

Hardware Some Basic Computer Components Some Basic Computer Components CPU: Central Processing Unit CPU: Central Processing Unit The computer’s central “brain” The computer’s central “brain” ALU: Arithmetic and Logic Unit ALU: Arithmetic and Logic Unit Memory Memory ROM: Read Only Memory ROM: Read Only Memory RAM: Random Access Memory RAM: Random Access Memory Storage Storage Hard Disk, CD-Rom, etc. Hard Disk, CD-Rom, etc. Input Input Keyboard, Mouse… Keyboard, Mouse… Output Output Monitor, Printer… Monitor, Printer…

Software Computer Program Computer Program A set of instructions that the computer will complete A set of instructions that the computer will complete The instructions that are used are defined by a programming language The instructions that are used are defined by a programming language

Programming Languages High Level Languages High Level Languages The languages you usually here about are high level languages (Python, C++, Java, Visual Basic.. The languages you usually here about are high level languages (Python, C++, Java, Visual Basic.. These languages are used to write the everyday applications we see These languages are used to write the everyday applications we see Use complex instructions that can’t be “directly” understood by a computer’s hardware Use complex instructions that can’t be “directly” understood by a computer’s hardware

High Level Code (Python) metres = float(raw_input( \ "Enter your height (in metres): ")) total_inches = * metres feet = int(total_inches/12) inches = total_inches - feet*12 print "You are " + str(feet) + " feet and " \ + str(inches) + " inches tall."

Programming Languages Machine Language Machine Language Processors have a small set of simple instructions they understand Processors have a small set of simple instructions they understand Access/store a value, add two values, compare two values,… Access/store a value, add two values, compare two values,… Different processor types have different instructions Different processor types have different instructions Each instruction is identified by a unique number Each instruction is identified by a unique number

Programming Languages Assembly Language Assembly Language Machine language is difficult for humans to work with directly (its all numbers) Machine language is difficult for humans to work with directly (its all numbers) Assembly Language is one step higher Assembly Language is one step higher The instructions are given short names (mnemonics) so it is readable The instructions are given short names (mnemonics) so it is readable A compiler converts the text of a program in assembly language into the appropriate Machine Language A compiler converts the text of a program in assembly language into the appropriate Machine Language

Assembly Language Code ORG $0000 N1 DB % N2 DB !41 ANS1 RMB 1 ANS2 RMB 1 ORG $0010 START LDS #00FF LDD #!0 LDX #!0 LDY #!0 PSHA LDAA N1 PSHA..

Programming Languages Back to High Level Languages Back to High Level Languages Instead of using the simple instructions of assembly language we work with more readable high level languages Instead of using the simple instructions of assembly language we work with more readable high level languages As with assembly language a compiler or interpreter is needed to convert the code to the machine language As with assembly language a compiler or interpreter is needed to convert the code to the machine language

Python Interpreted vs Compiled Interpreted vs Compiled Compiled languages (C++, Java) are written as text and then must be compiled into machine code Compiled languages (C++, Java) are written as text and then must be compiled into machine code Interpreted languages (Python) are written as text, but do not need to be compiled. When run, an interpreter, converts the code line by line Interpreted languages (Python) are written as text, but do not need to be compiled. When run, an interpreter, converts the code line by line

Advantages Compiling Compiling Faster at runtime, no translation to machine code needed Faster at runtime, no translation to machine code needed Interpreting Interpreting More flexibility when editing, don’t have to recompile every time you want to test a change More flexibility when editing, don’t have to recompile every time you want to test a change More flexible at runtime (though we probably won’t take advantage of this in 120) More flexible at runtime (though we probably won’t take advantage of this in 120)

Hello World! The first program people often write simply tells the computer to print the phrase “Hello World!” The first program people often write simply tells the computer to print the phrase “Hello World!” The simplicity of a language can be seen to some extent by how complex the code needed to do this is. The simplicity of a language can be seen to some extent by how complex the code needed to do this is.

Hello World! Python Python print "Hello World!" C++ C++ #include #include using namespace std; int main (){ cout << "Hello World!"; return 0; } Java Java public class HelloWorld { public static void main(String[] args) { System.out.print("Hello World!"); }}

Python Powers of Two print "The first ten powers of 2." x=1 for i in range(10): print x, print x, x=x*2 x=x*2

C++ Powers of Two #include #include using namespace std; int main (){ int x = 1; cout << "The first ten powers of 2.\n"; for (int i=0; i < 10; i++){ cout << x << " "; x = x*2; } return 0; }