Patrick J. McSweeney MW: 5 – 8:30pm.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Basic Computer Components
COSC 120 Computer Programming
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
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.
CS 201 Overview of Computers & Programming Debzani Deb.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
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.
CS 0008 Day 2 1. Today Hardware and Software How computers store data How a program works Operators, types, input Print function Running the debugger.
ICAICT101A Operate a Personal Computer. A computer is an electronic device that allows you to process and store data (information)… 2.
Introduction to Computers and Programming
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.
CS 161 INTRO TO PROGRAMMING I Dr. Blaise W. Liffick Fall
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.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
INTRODUCTION TO COMPUTER PROGRAMMING itc-314 LECTURE 01.
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.
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.
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.
Computer Architecture
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Parts of the Computer System
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor)
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.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
HOW A COMPUTER PROCESSES DATA. What is hardware? Hardware is the electric, electronic and mechanical equipment that makes up a computer What is software?
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Chapter 1: Introduction to Computers and Programming
Chapter 1 Introduction 2nd Semester H
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving With C An Object Based Approach
UNDERSTANDING YOUR COMPUTER
BASIC PROGRAMMING C SCP1103 (02)
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
Computer Electronic device Accepts data - input
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Computer Electronic device Accepts data - input
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICS103 Programming in C 1: Overview of Computers And Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Patrick J. McSweeney MW: 5 – 8:30pm

 Computer Elements ◦ Hardware ◦ Software  Programming  Our First Program  Our Second Program

ComputerPerson doing Arithmetic CPU: executes computer instructions. RAM: Short term storage. Hard drive: Long-term storage I/O: Keyboard, mouse, monitor, Brain (minus memories) Paper to write on. Textbook - has problems. Eyes, hands, pencil…

 Central Processing Unit ◦ Little more than a complex calculator ◦ Repeatedly performs the same basic steps  Fetch  Decode  Execute ◦ Even though we call this the “brain” its really quite dumb, no decision making only does what its told. ◦ Has many registers to hold small amounts of data  Add R1 R2

 Random Access Memory ◦ Form of memory ◦ Volatile : loss of power wipes away data ◦ Short term memory.  To run a program (saved on your hard drive). It must first be copied to RAM, to be ‘fetched’ by the CPU.

 Magnetic storage has mechanical components  Non-Volatile: Permanent storage (without power memory remains).  Large (1GB= 1 billion bytes, 1TB = 1 trillion bytes) but slow-er.

 Input-Output: Ways to move data into and out-from.  Monitors, keyboard, mouse, network (modem), USB devices, speakers, printer,

 Programs are binary, executable files run by the CPU.  A program is a sequence of binary (1/0) instructions that are interpretable by a CPU.  Common program examples: Internet Explorer, Microsoft Word, PowerPoint, Excel; ITunes, etc.

Operating System (Mac OS, Windows, Linux, Unix) All Programs System Calls Hardware

 Operating systems are special programs that have direct access to a computer’s hardware.  Operating Systems are in charge of running programs.  A program being run by the OS that needs to use hardware uses system calls.

 Programming Languages can be divided into two different classes: ◦ High Level Language: C (what we will be learning), Java, C++, C#, Cobol, Pascal. High level languages are designed to be “readable” for humans. ◦ Assembly Language: Binary computer instructions for the CPU. Assembly level languages are designed to be readable to the machine.

 An algorithm is a series of steps which solve a problem or perform a particular task.  Source code is an implementation of an algorithm. Algorithm for checking my 1)Turn on my computer 2)Login to my computer 3)Open an internet browser 4)Enter the URL for my online mail 5)Hit enter to go there 6)Enter my user name and password 7)Select OK

 Form groups of 2 or 3 and write an algorithm for one of the following tasks: ◦ How to make a peanut butter and jelly sandwich. ◦ How to tie your shoelaces. ◦ How to write a letter. Try to get at least 10 steps. We’ll take 10 – 15 minutes.

 A compiler is a program takes as input a high level language document and outputs assembly level documents. Source Code Source Code Assembl y Code Compil er

 A linker is a program that takes assembly documents and combines them into a single executable file. Assemb ly Linke r Assemb ly Executabl e

 Syntax Error: An error that breaks our syntax rules is caught during compilation: “She; was I friend”  Semantics Error: An error that breaks common sense may not be caught until the program runs: “The pink nose flew to the country.”

 Syntax: Defines the structure of a source code document. Is a set of rules that outline what are acceptable combination of symbols.  Semantics: reflects the meaning of programs. “Jack kicks a red ball.” Syntax: “Jack” “kicks” “red” Subject verb adjective “ball”. object. Semantics

 Get together with your groups of 2 or three and create sentences which are: ◦ Syntactically incorrect. ◦ Semantically incorrect, but syntactically correct.

Start Edit Source File Compile Synta x Errors ? Yes Link Execute No Correc t? Done Yes No source.c source.o source.e xe

#include int main (void) { //A comment printf(“Welcome to CPS 196! \n”); return 0; } File: cps196.c

1. #include This is called a preprocessor directive. stdio.h tells the compiler about the printf command on line 5 in our program. As the course progresses we will learn about more preprocessors.

2. int main(void)  This marks the opening of our program. It tells the compiler that what follows between { and } is our code.  All executable programs in C will have an “int main (void)”  The “int” stands for integer. It implies that at the end of this program we will return a whole number.  The void tells the compiler that this program takes no parameters (inputs).

3. { This is the opening bracket for our program.

4. // A comment  Sometimes it is useful to write notes in our programs.  These notes are ignored by the compiler.  Usually these notes are for ourselves so we can remember what we did if we have to come back and look at our source code again.

5. printf(“Welcome to CPS 196! \n”);  The printf command displays messages to the user of our program.  printf takes a String as a parameter (input).  The string is displayed.  “\n” is a special character that means put a new line here.

6. return 0;  Here we mark the end of our program by returning an integer to the operating system.  0 indicates a successful execution  Other integers can be used to indicate errors that may have arose.

#include int main (void) { int value; printf(“Please enter a number: ”); scanf(“%d”, &value); printf(“You entered a: %d! \n”, value); return 0; } File: cps196.c

int value; “int” here again means integer (whole number). value is a container called a variable that can hold an integer. We say that value has type integer.

scanf(“%d”, &value); “scanf” is the opposite of “printf()”. “printf” displays a data to the screen. “scanf()” gets input from the keyboard. “%d” is a special character that tells scanf to try and get an integer from the keyboard. &value is a way of saying store the result from the keyboard in variable value.

 Compiler  High level language  Assembly language  Program  Operating System  CPU  RAM  Hard drive  Input/output Lecture 1 Terms & Concepts  Linker  Syntax & Semantics  Algorithm  General work flow  “int main(void)  “printf”  Variable