CHAPTER 1: Introduction to Computers and Programming CSEB113 PRINCIPLES of PROGRAMMING CSEB134 PROGRAMMING I by Badariah Solemon 1BS (May 2012)

Slides:



Advertisements
Similar presentations
CS101: COMPUTER PROGRAMMING Lecture 1: Introduction to Computer and Programming.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
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.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Chapter 1: An Overview of Computers and Programming Languages
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Topic 1: Introduction to Computers and Programming
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.
CHAPTER 1: Programming Fundamentals CSEB113 PRINCIPLES of PROGRAMMING by Badariah Solemon 1BS (May 2013)
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
CS102 Introduction to Computer Programming
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of 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.
Principles of Programming - NI July Chapter 1: Introduction In this chapter you will learn about: Overview of PC components The different types.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
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.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 1 An Overview of Computers and Programming Languages.
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
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.
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.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
CSEB114: Principle of Programming Chapter 1: Introduction to Computer and Programming.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
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)
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
 Getting ready to code Lecture 1 Match 4, Course syllabus 
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
Chapter 1 An Overview of Computers and Programming Languages.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
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.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Java Programming: From the Ground Up
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
Overview of Computers and Programming Chapter 1
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
CHAPTER 1: Introduction to Computers and Programming
C++ Programming: From Problem Analysis to Program Design
Computer Science I CSC 135.
Computers: Hardware and Software
Topics Introduction Hardware and Software How Computers Store Data
Introduction to Computer Programming
ICT Programming Lesson 1:
Chapter 1: Preliminaries
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

CHAPTER 1: Introduction to Computers and Programming CSEB113 PRINCIPLES of PROGRAMMING CSEB134 PROGRAMMING I by Badariah Solemon 1BS (May 2012)

Topics 1.Overview of PC components 2.Programming languages 3.C programming language 4.C programming environment 5.C program at a glance 2BS (May 2012)

OVERVIEW OF PC COMPONENTS Topic 1 3BS (May 2012)

Elements of a Computer Hardware Software Program? BS (May 2012)

Main Memory A semiconductor device which stores the information necessary for a program to run. Types: 1.ROM (Read Only Memory) Contains information that is necessary for the computer to boot up The information stays there permanently even when the computer is turned off. 2.RAM (Random Access Memory) Contains instruction or data needed for a program to run Got erased when the computer is turned off. 5BS (May 2012)

Anatomy of Main Memory Memory may be conceptually viewed as an ordered sequence of storage location called memory cells. Information is stored in memory in bits A memory cell is a group of bits called a byte Each memory cell has a unique address A A A A A A A A A B B B B B B B B B1 6BS (May 2012) Ref: Tan and D’Orazio, C Programming for Engineering & Computer Science, New York: McGraw-Hill

CPU Does most of the work in executing a program The CPU inside a PC is usually the microprocessor Three main parts: 1.Control Unit Fetch instructions from main memory and put them in the instruction register 2.ALU (Arithmetic Logic Unit) Execute arithmetic operations 3.Registers Temporarily store instructions or data fetched from memory 7BS (May 2012)

Secondary Storage Devices Magnetic devices used to store a large amount of information. Store the software components or data needed for the computer to execute its tasks. Could be “read only” or “writable”. Example: 8BS (May 2012)

Input/Output Devices Input Devices – Accepts information from the user and transforms it to digital codes that the computer can process – Example: Output Devices – An interface by which the computer conveys the output to the user – Example: 9BS (May 2012)

Computer Networks Computers are now linked together in networks – communicate Types: 1.LAN ( ) Computers and other devices in a building are connected by cables or wireless network 2.WAN ( ) Links many individual computers and LANs over a large geographic area The most well-known WAN is _____________ 10BS (May 2012)

Software Consists of programs that enable us to solve problems with a computer Operating Systems Application Software Utility Programs Language Translation System Software 11BS (May 2012) *Complete this list

PROGRAMMING LANGUAGES Topic 2 12BS (May 2012)

What is Programming? Programming is instructing a computer to do something for you with the help of a programming language A programming language contains instructions for the computer to perform a specific action or a specific task: – 'Calculate the sum of the numbers from 1 to 10‘ – 'Print “I like programming”‘ – 'Output the current time' 13BS (May 2012)

What is Programming? Programming Language is different compared to our everyday-language (natural language); spoken and written – Does not have to be 100% but still understandable – Depends on circumstances; the context – one word can have many meaning depending on the situation For example: – OPERATE 14BS (May 2012)

What is Programming? The two roles of a programming language: – Technical: It instructs the computer to perform tasks. – Conceptual: It is a framework within which we organize our ideas about things and processes. In programming, we deal with two kind of things: – Data - representing 'objects' we want to manipulate – Procedures -'descriptions' or 'rules' that define how to manipulate data 15BS (May 2012)

Programming Language Programming Language is a Formal Language used to communicate to a computer. – Very specific (one word means one thing – context free) since to 'talk' to a computer; to instruct a computer; our commands must be 100% clear and correct. – Either Functional - tell what to do but not how (sum [1...10]) – or Imperative - describing the step by step to accomplish the task (Take the first number and add the next number to it; then add the next number to the sum; and …………; until you have reached 10 as number to be added. Then print the sum of all numbers) 16BS (May 2012)

Programming Language Can be classified into as a special-purpose and general-purpose programming languages. Special-purpose : is design for a particular type of application – Structured Query Language (SQL) General-purpose : can be used to obtain solutions for many types of problems 1.Machine Languages 2.Assembly Languages 3.High-Level Languages 17BS (May 2012)

1. Machine Language The only language that the processor actually understand. Consists of binary codes: 0 and 1 Example: Each of the lines above corresponds to a specific task to be done by the processor. Programming in machine code is difficult and slow since it is difficult to memorize all the instructions. Mistakes can happen very easily. Processor dependent (different machine language for different CPU) - not portable 18BS (May 2012)

2. Assembly Language Enable machine code to be represented in words and numbers. Example of a program in assembly language: LOAD A, 9999 LOAD B, 8282 Cannot be processed directly by a computer, must be converted to machine language using assemblers Easier to understand compared to machine code but still is quite difficult to use. Each instruction corresponds to a specific machine code: lengthy programs. Processor dependent and not portable. 19BS (May 2012) LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A Assembler

3. High-level Language Use more English words. They try to resemble English sentences so easier to program in these languages. Example: printf (“Hello”) The programming structure is problem oriented - does not need to know how the computer actually executes the instructions. Processor independent - the same code can be run on different processors. Needs to be analyzed by the compiler and then compiled into machine code so that it can be executed by the processor. Example languages – Java, BASIC, C, C++ 20BS (May 2012)

C PROGRAMMING LANGUAGE Topic 3 21BS (May 2012)

What is ‘C’? Why ‘C’? - Because based on 'B'; developed at Bell Laboratories C was developed by Dennis Ritchie at Bell Laboratories in C combines the power of high-level languages with the power of assembly languages. Starts as a system implementation language, but has evolved into general-purpose language and available for a wide variety of computers. C coupled with good program design techniques - generate well structured, easy to read and easy to maintain program 22BS (May 2012)

What is ‘C’? In 1983, the American National Standards Institute (ANSI) set up X3J11, a Technical Committee to draft a proposal for the ANSI standard, which was approved in 1989 and referred to as the ANSI/ISO 9899 : 1990 or simply the ANSI C, which is now the global standard for C. 23BS (May 2012)

C – An Imperative Language C is a highly imperative language – We must tell it exactly how to do what; – the means and functions to use; – which libraries to use; – when to add a new line; – when an instruction is finished; – in short: everything and anything… Hint: Observe the syntax in the next slide – Semantics – the meaning of the language within a given context – Syntax - Syntax are the rules to join words together in forming a correct expression or phrase. 24BS (May 2012)

Example of a C program function for printing a character/string 25BS (May 2012) *Complete the labeling

C PROGRAMMING ENVIRONMENT Topic 4 26BS (May 2012)

IDE The system software necessary to develop C application program are bundled into an integrated development environment (IDE) A typical IDE contains text editor, C compiler, preprocessor, libraries, other tools Components of C programming environment: – Language – features to carry out basic operations (Ex. Compare data values, arithmetic operation) – Libraries – routines to carry out operations not part of the language (Standard libraries – ex. #include & programmer-defined libraries) 27BS (May 2012)

Ms Visual C++ 28BS (May 2012)

C PROGRAM AT A GLANCE Topic 5 29BS (May 2012)

A Simple C Program Output: 30BS (May 2012) CONSOLE VIEW of the C program’s output

Summary PC components – Hardware : main memory, CPU, storage devices, I/O devices – Software : system software & application software Programming languages – Machine language, assembly language, high-level languages C as a highly imperative language A typical C programming environment contains text editor, C compiler, preprocessor, libraries, other tools 31BS (May 2012)