Main Memory Central Processor Unit Keyboard Input Device Secondary Memory Monitor Printer Output Devices.

Slides:



Advertisements
Similar presentations
Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
Advertisements

EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
COSC 120 Computer Programming
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
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.
Three types of computer languages
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
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,
Topic 1: Introduction to Computers and 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.
Systems Software Operating Systems.
COMPUTER SOFTWARE Chapter 3. Software & Hardware? Computer Instructions or data, anything that can be stored electronically is Software. Hardware is one.
Computers and Programming อนันต์ ผลเพิ่ม Anan Phonphoem
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Introducing Java.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Topics Introduction Hardware and Software How Computers Store Data
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
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.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
Introduction to Programming Using C Introduction to Computer Programming.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Computer Engineering 1 nd Semester Dr. Rabie A. Ramadan 2.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
Overview of Programming and Problem Solving Textbook Chapter 1 1.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
Lecture 8 February 29, Topics Questions about Exercise 4, due Thursday? Object Based Programming (Chapter 8) –Basic Principles –Methods –Fields.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
1 C++ Programming Basics Chapter 1 Lecture CSIS 10A.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 Software. 2 What is software ► Software is the term that we use for all the programs and data on a computer system. ► Two types of software ► Program.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Problem Solving Techniques Using Pascal Allen C.-H. Wu Department of Computer Science Tsing Hua University Hsinchu, Taiwan 30043, ROC
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Chapter 1 Getting Acquainted With Computers, Programs, and C++
Basic Computer Organization Rashedul Hasan.. Five basic operation No matter what shape, size, cost and speed of computer we are talking about, all computer.
Lecture on Central Process Unit (CPU)
Computers and Programming ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem
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)
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,
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
UNIX U.Y: 1435/1436 H Operating System Concept. What is an Operating System?  The operating system (OS) is the program which starts up when you turn.
Chapter 1: Introduction to Computers and Programming
Chapter 1 Introduction 2nd Semester H
Topic 2: Hardware and Software
Java Programming: From the Ground Up
Chapter 1: Introduction to computers and C++ Programming
Topics Introduction Hardware and Software How Computers Store Data
The Operating System Nick Sims.
Chapter 1. Introduction to Computers and Programming
Chapter 1: Introduction to Computers and Programming
Computer Science I CSC 135.
Topics Introduction Hardware and Software How Computers Store Data
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Basic Computer Organization
Overview of Computer system
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Main Memory Central Processor Unit Keyboard Input Device Secondary Memory Monitor Printer Output Devices

MEMORY - (data and instructions) 1. Each cell has a VALUE and ADDRESS 2. One value at a time 3. Move a COPY to a new location 4. Size of memory varies byte = 8 bits word = multiple of bytes usually transparent to you (not important here)

MEMORY - (data and instructions cont.) Computer Memory with 1000 cells Words have multiple BYTES BYTES have multiple (8) BITS

Central Processing Unit I/O Devices Secondary Memory Disk or Tape Slower Larger-> Reasons for different types Cheaper

What do Computers Do? (example like p.8 of notes) 1. Fetch instruction (add) 2. Decode instruction 3. Fetch operands ( NMBR1, NMBR2 ) 4. Perform operation ( NMBR1 + NMBR2 ) 5. Store results (put sum in location for Sum ) REPEAT In other words - they always(only) run programs What happens when you turn it on? Runs bootstrap program Bootstrap program loads OS (unix) Unix loads other programs (including “shell”) “shell” will read commands load program run program wait for the next command

What does “unix” do for you? 1. Manage resources  Who runs and how long  Who uses devices such as disk 2. Provide Protection  Who uses machine  Users only have access to what they need 3. Provide programs you need  Compilers  Building programs  File utilities (create, delete, rename, etc)  Printing utilities Your lab instructor will show you how to use unix

Entering, Compiling and Running a Program 1. Use an editor (like “emacs”) to enter the program and save it on the disk. 2. Use a compiler (like “g++”) to translate the program into machine language 3. Link libraries with your program (auto) 4. Execute the machine language version (like “emacs”, “g++” or “a.out”)

MODELS for learning The process of learning about computers is one of building a MENTAL MODEL of what happens. As you become more knowledgeable about computers your model will become more sophisticated and more accurate. Accept the limitations of your models, but question your instructor if you have any suspicion that your model of what is happening is wrong. Language Problems Realize that English itself is very INaccurate. YOU make it reasonable by associating the MOST REASONABLE interpretation to the statements. Learning to be precise with c++ will take practice!

Overview of c++ Objectives 1. Recognizing the non-linear nature of program complexity the need for simple interfaces that OOP/OOD is a long-term goal 2. Understanding that obtaining a program that “works” is insufficient. Style is an important part of programming.

Complexity of Software Size of Program Complexity LINEARNON-LINEAR 1. Stay in this area 2. Break large systems into small pieces 3. Interfaces of the pieces become a problem

Tools Building your program from good tools (software) makes your job less complicated REUSABILITY of code has been historically LOW OOP/OOD increases REUSABILITY!

OOD (Object-Oriented Design) OOP (Object-Oriented Programming) The DESIGN process is fairly independent of the language as long as the language is object-oriented. C++ is used in our course because of its widespread acceptance support not necessarily because it is the best OOP language.

Sample c++ program. Version 1. Convert Square Meters to Square Yards. (INPUT ->)PROCESS -> OUTPUT Calculate the answerOutput the answer #include void main () { cout << 20 * 1.196; //20 SqMeters to SqYards } Problems 1. Always uses the same numbers (solves the same problem). NOT GENERAL! 2. Only numbers on output! NEEDS LABELLING! 3. Observer does not understand what we're doing! NEEDS DOCUMENTATION! drake> g++ version1.C drake> a.out drake>

Same Program. Version 2. #include void main() {// declare variables and constants const float meters_to_yards = 1.196; float size_in_sqmeters; size_in_sqmeters = 20; float size_in_sqyards; // calculate square yards size_in_sqyards = size_in_sqmeters * meters_to_yards; // output square yards cout << "The size in square yards is "; cout << size_in_sqyards << "\n"; } drake> g++ version2.C drake> a.out The size in square yards is drake> GOOD -> Provided DOCUMENTATION and LABELLING BAD ->Still NOT GENERAL

Version 3. #include void main() {// declare variables and constants const float meters_to_yards = 1.196; float size_in_sqmeters, size_in_sqyards; // read size in square meters cin >> size_in_sqmeters; // calculate square yards size_in_sqyards = size_in_sqmeters * meters_to_yards; // output square yards cout << "The size in square yards is "; cout << size_in_sqyards << "\n"; } drake> g++ version3.C drake> a.out 20 The size in square yards is drake> a.out 10 The size in square yards is drake> STILL NEED to PROMPT USER!

Version 4. #include void main() {// declare variables and constants const float meters_to_yards = 1.196; float size_in_sqmeters, size_in_sq_yards; // read size in square meters cout "; cin >> size_in_sqmeters; // calculate square yards size_in_sqyards = size_in_sqmeters * meters_to_yards; // output square yards cout << "The size in square yards is "; cout << size_in_sqyards << "\n"; } drake> g++ version4.C drake> a.out Enter the number of square meters -> 20 The size in square yards is drake> a.out Enter the number of square meters -> 10 The size in square yards is drake> DONE!