programming methodology-1.1

12

Click here to load reader

Upload: nyversity

Post on 21-Jun-2015

124 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Programming methodology-1.1

Programming Methodology

By:Anh Duong

Page 2: Programming methodology-1.1
Page 3: Programming methodology-1.1

Programming Methodology

By:Anh Duong

Online:< http://cnx.org/content/col10450/1.1/ >

C O N N E X I O N S

Rice University, Houston, Texas

Page 4: Programming methodology-1.1

This selection and arrangement of content as a collection is copyrighted by Anh Duong. It is licensed under the

Creative Commons Attribution 2.0 license (http://creativecommons.org/licenses/by/2.0/).

Collection structure revised: August 22, 2007

PDF generated: October 26, 2012

For copyright and attribution information for the modules contained in this collection, see p. 5.

Page 5: Programming methodology-1.1

Table of Contents

1 Introduction

1.1 PC Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Basic C++

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4Attributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Page 6: Programming methodology-1.1

iv

Available for free at Connexions <http://cnx.org/content/col10450/1.1>

Page 7: Programming methodology-1.1

Chapter 1

Introduction

1.1 PC Architecture

1.1.1 computer architecture1

1.1.1.1 Computer Hardware

A computer may be divided into six logical units.Input Unit

• Obtain information from input devices: keyboards and mouse devices.• Place the information at the disposal of the other units to be processed.

Output Unit

• Take information that has been processed.• Place it on output devices: displayed on screens, printed on paper.

Memory Unit

• RAM (random access memory) is volatile, stores program and data.• ROM (read only memory) is non-volatile, contains fundamental instructions.

Arithmetic and Logic Unit (ALU)

• Perform all the arithmetic and logic operations: addition, subtraction, comparison, etc..

CPU

• Tell the input unit when information should be read into the memory unit.• Tell the ALU when information from the memory should be used in calculations.• Tell the output unit when to send information from the memory unit to certain output devices.

Secondary Storage.

• Permanent storage areas for programs and data: magnetic tapes, magnetic hard disks, �oppy disk, CDROM

1This content is available online at <http://cnx.org/content/m15039/1.1/>.

Available for free at Connexions <http://cnx.org/content/col10450/1.1>

1

Page 8: Programming methodology-1.1

2 CHAPTER 1. INTRODUCTION

1.1.1.2 Computer Software

• A computer program: set of instructions used to operate a computer to produce a speci�c result.• Computer programming: writing computer programs.• Programming languages: languages used to create computer programs.

Machine LanguagesExample: 0101010 000000000001 000000000010

• The lowest level of computer languages.• Programs consist of entirely of 1s and 0s.• Programs can control directly to the computer's hardware.• Machine language instructions consist of two parts:

· Instruction part (opcode) is the leftmost group of bits and tells the computer the operation to beperformed.

· Address part speci�es the memory address of the data to be used in the instruction.

Assembly LanguagesExample:LOAD BASEPAYADD OVERPAYSTORE GROSSPAY

• Perform the same tasks as machine languages, but use symbolic names for opcodes and operands.• An assembly language program must be translated into a machine language program.

Translation program (assembler)Machine languageprogramAssembly languageprogram

• Machine languages and assembly languages are called low-level languages since they are closest tocomputer hardware.

High-level Programming Languages

• Create computer programs using instructions that much easier to understand: English-like includedwith mathematical notations.

• Programs written in high-level languages must be translated into a low level language using a programcalled a compiler.

• Each line in a high-level language program is called a statement.

Ex: Result = (First + Second)*Third.Application and System Software

• Application software: perform particular tasks required by the users.• System software: must be available to any computer system to operate. The most important system

software is the operating system (MS-DOS, UNIX, MS WINDOWS, MS WINDOWS NT)

• Multitasking systems: operating systems allow user to run multiple programs.

Available for free at Connexions <http://cnx.org/content/col10450/1.1>

Page 9: Programming methodology-1.1

Chapter 2

Basic C++

Available for free at Connexions <http://cnx.org/content/col10450/1.1>

3

Page 10: Programming methodology-1.1

4 INDEX

Index of Keywords and Terms

Keywords are listed by the section with that keyword (page numbers are in parentheses). Keywordsdo not necessarily appear in the text of the page. They are merely associated with that section. Ex.apples, � 1.1 (1) Terms are referenced by the page they appear on. Ex. apples, 1

A architecture, � 1.1.1(1) C computer, � 1.1.1(1)

Available for free at Connexions <http://cnx.org/content/col10450/1.1>

Page 11: Programming methodology-1.1

ATTRIBUTIONS 5

Attributions

Collection: Programming Methodology

Edited by: Anh DuongURL: http://cnx.org/content/col10450/1.1/License: http://creativecommons.org/licenses/by/2.0/

Module: "computer architecture"By: Anh DuongURL: http://cnx.org/content/m15039/1.1/Pages: 1-2Copyright: Anh DuongLicense: http://creativecommons.org/licenses/by/2.0/

Available for free at Connexions <http://cnx.org/content/col10450/1.1>

Page 12: Programming methodology-1.1

Programming Methodology

This course provides students with methodology in programming, using C++ in almost examples.

About Connexions

Since 1999, Connexions has been pioneering a global system where anyone can create course materials andmake them fully accessible and easily reusable free of charge. We are a Web-based authoring, teaching andlearning environment open to anyone interested in education, including students, teachers, professors andlifelong learners. We connect ideas and facilitate educational communities.

Connexions's modular, interactive courses are in use worldwide by universities, community colleges, K-12schools, distance learners, and lifelong learners. Connexions materials are in many languages, includingEnglish, Spanish, Chinese, Japanese, Italian, Vietnamese, French, Portuguese, and Thai. Connexions is partof an exciting new information distribution system that allows for Print on Demand Books. Connexionshas partnered with innovative on-demand publisher QOOP to accelerate the delivery of printed coursematerials and textbooks into classrooms worldwide at lower prices than traditional academic publishers.