C++ Course SarMag Trimester 31 Programming in C++ Prerequisite: CS1 or some programming experience Text: C++ How to Program, Deitel & Deitel.

Slides:



Advertisements
Similar presentations
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Advertisements

Lecture 1: Overview of Computers & Programming
Digital Data Representation
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
The Binary Machine Modern high-level programming languages are designed to make programming easier. On the other end, the low level, all modern digital.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Computers: Tools for an Information Age
Chapter 16 Programming and Languages: Telling the Computer What to Do.
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.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 1: Getting Started by George Lamperti & BU Faculty.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
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 Introduction to Programming. Computer Hardware CPU Memory –Main or primary –Secondary or auxiliary Input device(s) Output device(s)
1 Programming Languages Examples: C, Java, HTML, Haskell, Prolog, SAS Also known as formal languages Completely described and rigidly governed by formal.
The computer memory and the binary number system.
CIS 115 Lecture 1.  Hardware: Electronic Devices  Software: Instructions and Computer Programs.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
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 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction CS 104: Applied C++ What is Programming? For some given problem: __________ a solution for it -- identify, organize & store the problem's.
Computer Programming Basics Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University, Korea.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
CS CS CS IA: Procedural Programming CS IB: Object-Oriented Programming.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CS Computer Science I. BCPL was developed in 1967 as a language for writing operating systems and software compilers In 1970, the creators of the.
Introduction 1 (Read Chap. 1) What is Programming? For some given problem: design a solution for it -- identify, organize & store the problem's data --
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming Dr. Halla Abdel Hameed.
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.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Chapter 1 Introduction 2nd Semester H
Software Development Environment
BASIC PROGRAMMING C SCP1103 (02)
CSCI-235 Micro-Computer Applications
BASIC PROGRAMMING C SCP1103 (02)
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
CSCE Fall 2013 Prof. Jennifer L. Welch.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
CSCE Fall 2012 Prof. Jennifer L. Welch.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICT Programming Lesson 1:
Programming Logic and Design Eighth Edition
Presentation transcript:

C++ Course SarMag Trimester 31 Programming in C++ Prerequisite: CS1 or some programming experience Text: C++ How to Program, Deitel & Deitel

C++ Course SarMag Trimester 32 Computers and Programs A simplified model of a computer consists of a processing unit (CPU) and a memory. CPU can understand simple instructions: –read/write a memory location –add two numbers –compare numbers –etc.

C++ Course SarMag Trimester 33 Machine Code An executable program is a sequence of these simple instructions. The sequence is stored in memory. The CPU processes the simple instructions sequentially. –Some instructions can tell the CPU to jump to a new place in memory to get the next instruction.

C++ Course SarMag Trimester 34 Instructions Each instruction is stored in memory as a bunch of bits. The CPU decodes the bits to determine what should happen. For example, the instruction to add 2 numbers might look like this:

C++ Course SarMag Trimester 35 Memory The Memory can hold programs and data. Each piece of data is also just a bunch of bits. Typically the memory is organized in chunks of 8 bits (called a byte). Each chunk (byte) has an address.

C++ Course SarMag Trimester 36 A Picture CPU... MEMORY Address...

C++ Course SarMag Trimester 37 Sample Program #Instruction 1Set memory[801] to hold Set memory[802] to hold If memory[802] = 10 jump to instruction #8 4increment memory[802] 5set memory[803] to 2 times memory[801] 6put memory[803] in to memory[801] 7jump to instruction #3 8print memory[801]

C++ Course SarMag Trimester 38 Another Picture CPU Instruction #1 Instruction #2 Instruction #3 Instruction #4 Instruction #5 Instruction #6... MEMORY Address

C++ Course SarMag Trimester 39 Human vs Machine Programs The computer can only understand the bits (the encoded program) Humans don't like to deal with bits, so they developed english-like abbreviations for programs. Assembly Language Machine Language

C++ Course SarMag Trimester 310 Assembly & Machine Language ST 1,[801] ST 0,[802] TOP:BEQ [802],10,BOT INCR [802] MUL [801],2,[803] ST [803],[801] JMPTOP BOT:LD A,[801] CALL PRINT Assembly Language Machine Language

C++ Course SarMag Trimester 311 An Assembler Assembly Language Program ST 1,[801]... Assembly Language Program ST 1,[801]... Machine Language Program Machine Language Program Assembler

C++ Course SarMag Trimester 312 Higher-Level Languages Assembly Language is much easier to deal with than Machine Language, but you need to know about all the instructions. People developed languages that were independent of the specific machine language. –More abstract representation of instructions.

C++ Course SarMag Trimester 313 High-Level Languages Many high-level languages have been developed. –Different ways of representing computations. –Different languages for different needs: symbolic vs. numeric computation human efficiency vs. program efficiency portability extensibility

C++ Course SarMag Trimester 314 C++ C++ is an extension of C. C++ was first developed in the early 1980s (back in the last century!). Focus was on Object Oriented Programming –view computer programs as collection of objects. –Objects have attributes and actions.

C++ Course SarMag Trimester 315 As a C/C++ program set memory[801] to hold set memory[802] to hold if memory[802] = 10 jump to instruction #8 increment memory[802] set memory[803] to 2 times memory[801] put memory[803] in to memory[801] jump to instruction #3 print memory[801] x=1; i=0; while (i!=10) { i++; x=x*2; } printf("%d",x); }

C++ Course SarMag Trimester 316 Compiler C++ Program int main() { int i=1;... C++ Program int main() { int i=1;... Machine Language Program Machine Language Program C++ Compiler Created with text editor or development environment

C++ Course SarMag Trimester 317 Many Different Compilers There are many different C++ Compilers: –Microsoft Visual C++ –Borland C++ –GNU g++ –IBM xlc –Sun CC

C++ Course SarMag Trimester 318 What is an Algorithm? Algorithm = Calculation Procedure The traditional definition of "algorithm" is that it is a formally defined procedure for performing some calculation A finite ordered set of well defined rules for the solution of a problem. Algorithms are often written in pseudocode, so that they can be easily converted in many different programming languages

C++ Course SarMag Trimester 319 What is an Algorithm? algorithm is a set of step-by-step commands or instructions designed to reach a particular goal algorithm A mathematical procedure used to solve problems with a series of steps.

C++ Course SarMag Trimester 320 Properties of Algorithms 1. Finiteness/ Terminate 2. Absence of Ambiguity 3. Definite/ Clear 4. Efective 5. Input 6. Output (KNU-69, HOR-90)

C++ Course SarMag Trimester 321 Prinsip Pemrograman Harus dapat menentukan masalah sesungguhnya. Design program Struktur data Coding program Testing program Pemeliharaan program + Dokumentasi

C++ Course SarMag Trimester 322 Aturan pemrograman Buat dokumentasi Buat semudah mungkin Gunakan modul jika dirasa program cukup besar Gunakan fungsi untuk suatu hal yg sering di gunakan Hindari penggunaan var global