©Brooks/Cole, 2003 Chapter 9 Programming Languages.

Slides:



Advertisements
Similar presentations
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Advertisements

Lecture 2 Introduction to C Programming
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
True or false A variable of type char can hold the value 301. ( F )
Chapter 3 Assignment and Interactive Input. 2 Objectives You should be able to describe: Assignment Operators Mathematical Library Functions Interactive.
Chapter 4 Summation.
Lecture 1 The Basics (Review of Familiar Topics).
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
COMP1170 Midterm Preparation (March 17 th 2009) Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education.
1 Expressions, Operators Expressions Operators and Precedence Reading for this class: L&L, 2.4.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
COMPUTER SCIENCE I C++ INTRODUCTION
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
Help session - C++ Arranged by : IEEE – NIIT Student Chapter.
High-Level Programming Languages: C++
A Review of Programming and C++
More on Input Output Input Stream : A sequence of characters from an input device (like the keyboard) to the computer (the program running). Output Stream.
INTRODUCTION. What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language,
Chapter 5 Control Structures: Loops 5.1 The while Loop The while loop is probably the most frequently used loop construct. The while loop is a conditional.
Introduction to Computer Systems and the Java Programming Language.
Unit 3, Lesson 3 Math Operations, Assignment Operators, and Arithmetic Operators Mr. Dave Clausen La Cañada High School
M.T.Stanhope Oct Title : C++ Basics Bolton Institute - Faculty of Technology (Engineering) 1 C++ Basics u Data types. u Variables and Constants.
C++ Programming: Basic Elements of C++.
Chapter 9 Programming Languages. Have a vision of computer language evolution. Distinguish between machine, assembly, and high-level languages. Understand.
THE BASICS OF A C++ PROGRAM EDP 4 / MATH 23 TTH 5:45 – 7:15.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Flow Control (for) Outline 4.1Introduction 4.2The.
CHAPTER 1.3 THE OPERATORS Dr. Shady Yehia Elmashad.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 27 HTTP and WWW.
Objective: Students will be able to: Declare and use variables Input integers.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Looping.
REPETITION STATEMENTS - Part1  Also called LOOP STATEMENTS OR LOOP STRUCTURES 1 C++ Statements that repeat one or more actions while some condition is.
Learners Support Publications Introduction to C++
Chapter 3 – Variables and Arithmetic Operations. First Program – volume of a box /************************************************************/ /* Program.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
Chapter Looping 5. The Increment and Decrement Operators 5.1.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 5 Looping.
Chapter Looping 5. The Increment and Decrement Operators 5.1.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
Arithmetic Operations (L05) * Arithmetic Operations * Variables * Declaration Statement * Software Development Procedure Problem Solving Using C Dr. Ming.
What Do Compilers Do 1 A compiler acts as a translator, transforming human-oriented programming languages into computer-oriented machine languages. Ignore.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
1 Chapter 4 - Control Statements: Part 1 Outline 4.1 Introduction 4.4 Control Structures 4.5 if Selection Structure 4.6 if/else Selection Structure 4.7.
C++ LANGUAGE MULTIPLE CHOICE QUESTION
Chapter 2: Basic Elements of C++
Chapter 4 – C Program Control
UMBC CMSC 104 – Section 01, Fall 2016
Chapter 2 Data Representation.
Chapter 3 Assignment and Interactive Input.
Completing the Problem-Solving Process
Chapter 2 Assignment and Interactive Input
Chapter 2.2 Control Structures (Iteration)
Arithmetic Operator Operation Example + addition x + y
Arrays, For loop While loop Do while loop
Structured Program Development in C
Review for Final Exam.
Programming Funamental slides
Chapter 4 - Program Control
C Operators, Operands, Expressions & Statements
3 Control Statements:.
Chapter 2.2 Control Structures (Iteration)
Review for Final Exam.
Engineering Problem Solving with C++ An Object Based Approach
Engineering Problem Solving with C++ An Object Based Approach
Fundamental Programming
Chap 7. Advanced Control Statements in Java
Using C++ Arithmetic Operators and Control Structures
Presentation transcript:

©Brooks/Cole, 2003 Chapter 9 Programming Languages

©Brooks/Cole, 2003 Have a vision of computer language evolution. Distinguish between machine, assembly, and high-level languages. Understand the process of creating and running a program. After reading this chapter, the reader should be able to: O BJECTIVES Distinguish between the different categories of languages: procedural, object-oriented, functional, declarative, and special. Become familiar with elements of the procedural language C.

©Brooks/Cole, 2003 EVOLUTIONEVOLUTION 9.1

Figure 9-1 Evolution of computer languages

©Brooks/Cole, Program 9.1 Program in machine language

©Brooks/Cole, 2003 The only language understood by a computer is machine language. Note:

©Brooks/Cole, 2003 Entry main,^m subl2 #12,sp jsb C$MAIN_ARGS movab $CHAR_STRING_CON pushal -8(fp) pushal (r2) calls #2,read pushal -12(fp) pushal 3(r2) calls #2,read mull3 -8(fp),-12(fp),- pushal 6(r2) calls #2,print clrl r0 ret Program 9.2 Multiplication Program in symbolic language

©Brooks/Cole, 2003 /* This program reads two integer numbers from the keyboard and prints their product. */ #include int main (void) { // Local Declarations int number1; int number2; int result; // Statements cin >> number1; cin >> number2; result = number1 * number2; cout << result; return 0; }// main Program 9.3 Multiplication Program in C++ language

©Brooks/Cole, 2003 BUILDINGAPROGRAMBUILDINGAPROGRAM 9.2

Figure 9-2 Building a program

©Brooks/Cole, 2003 PROGRAMEXECUTIONPROGRAMEXECUTION 9.3

Figure 9-3 Program execution

©Brooks/Cole, 2003 CATEGORIESOFLANGUAGESCATEGORIESOFLANGUAGES 9.4

Figure 9-4 Categories of languages

©Brooks/Cole, 2003 Figure 9-5 Function in a functional language

©Brooks/Cole, 2003 Figure 9-6 Extracting the third element of a list

©Brooks/Cole, 2003 Table 9.1 Common tags Meaning Meaning document document head document body document title different header levels boldface Italic underlined subscript superscript centered line break ordered list unordered list an item in the list an image an address (hyperlink) Beginning Tag Ending Tag

©Brooks/Cole, 2003 Sample Document This is the picture of a book: Program 9.4 HTML Program

©Brooks/Cole, 2003 A PROCEDURAL LANGUAGE:C LANGUAGE:C 9.5

©Brooks/Cole, 2003 Figure 9-7 Variables

©Brooks/Cole, 2003 Table 9.2 Arithmetic operators Example Example  4 Num * 5 Sum / Count Count % Count ++ Count  Operator        Definition Addition Subtraction Multiplication Division (quotient) Division (remainder) Increment Decrement

©Brooks/Cole, 2003 Table 9.3 Relational operators Example Example Num1 < 5 Num1 <= 5 Num2 > 3 Num2 >= 3 Num1 == Num2 Num1 != Num2 Operator <     Definition Less than Less than or equal to Greater than Greater than or equal to Equal to Not equal to

©Brooks/Cole, 2003 Table 9.4 Logical operators Example Example ! ( Num1 < Num2 ) (Num1 10 ) Operator ! && Definition NOT AND OR

©Brooks/Cole, 2003 Table 9.5 Assignment operators Meaning Store 5 in Num Num = Num + 5 Num = Num  5 Num = Num * 5 Num = Num / 5 Num = Num % 5 Operator == +=  = *= /= %= Example Example Num = 5 Num += 5 Num  = 5 Num *= 5 Num /= 5 Num %= 5

©Brooks/Cole, 2003 Figure 9-8 Statements

©Brooks/Cole, 2003 Figure 9-9 Side effect of a function

©Brooks/Cole, 2003 Figure 9-10 Function declaration

©Brooks/Cole, 2003 Figure 9-11 if-else statement

©Brooks/Cole, 2003 Figure 9-12 switch statement

©Brooks/Cole, 2003 Figure 9-13 while loop

©Brooks/Cole, 2003 Figure 9-14 for loop

©Brooks/Cole, 2003 Figure 9-15 do-while loop