Chapter 1 Introduction to Computers and Programming

advertisement

ITP 134 C++ Study Guide

Chapter 1 Introduction to

Computers and

Programming

Games & Graphics in C++

2 nd edition by Tony Gaddis

1.1

Introduction

Goal is to learn computer programming in a fun and interesting way.

Program - set of instructions that a computer follows to perform a task. (page 1)

Software - software is essential to a computer.

Programs are also known as software. (page 1)

Programmer or Software Developer - is a person with the training and skills necessary to design, create, and test computer programs.

(page 1)

1.2 Hardware

CONCEPT: The physical devices that a computer is made of are referred to as the computer's hardware . Most computer systems are made of similar hardware devices. (page 2)

Computer systems include: CPU, main memory, secondary storage devices, input devices and output devices.

1.3 How Computers Store Data

CONCEPT: All data that is stored in a computer is converted to sequences of 0s and 1s. (page 6)

Byte - One byte on a computer system will store a single character from a keyboard. Usually a byte is 8 bits. (page 6)

Bit - short for binary digit, this is the smallest

 amount of storage that can be referenced by an address. (page 6)

Binary numbering system - base 2 numbering system includes only 0s and 1s (page 7)

Storing Characters

ASCII - coding scheme that stored 128 different character so it uses 7 bits to store each character. Very common in computers in the

1960s and in early PCs. (page 9)

Unicode - coding scheme that can represent most of the spoken human languages.

Historically Unicode was encoded using 16 bits/character. A newer version, called UTF-8 , is useful for web pages, and is encoded using 8 bits per character It uses 16 bits to store each character, and is compatible with ASCII. (page

10)

Negative Integers

Twos complement notation - is used to store negative numbers. (page 10)

Real Numbers

Real numbers - numbers that contain a decimal point. (page 10)

Floating point notation - a way to encode real number using binary. The precision is the total number of digits that are used to store the real number. (page 10)

Other Types of Data

Digital - used to describe anything that uses binary numbers. (page 10)

Digital data - data that is stored in binary. (page

10)

Digital device - any device that works with binary data. (page 10)

1.4 How a Program Works

CONCEPT: A computer's CPU only understands instructions that are written in machine language.

Because people find it very difficult to write entire programs in machine language, other programming languages have been invented. (page 11)

Understand and be able to describe the Fetch

Decode Execute cycle . See Figures 1.14 and

1.15 and description on page 13.

ITP 134 - Mrs. Eaton Chapter 1 Study Guide – 2 nd Edition Page 1

From Machine Language to Assembly Language

Assembly language - created as an alternative to machine language. Each statement used a mnemonic to represent the different machine language codes. For example, add, load, sub, mult, div, stor are common mnemonics for many assembly languages. (page 14)

High-Level Languages

Assembly languages are considered low-level languages because they are so close to machine languages. (page 15)

High-level languages allows the programmer to write powerful and complex programs without knowing how the CPU works, machine language, or low-level instructions. (page 15)

Know the languages in Table 1-1 Programming

Languages and understand the importance of each one. Includes Ada, BASIC, FORTRAN,

COBOL, Pascal, C, C++ and C#, Java, JavaScript,

Python, Ruby and Visual Basic (pages 15-16)

Key Words, Operators, and Syntax: An Overview

Each high-level language has its own set of predefined key words that the programmer must know to write a program. These are known as key words or reserved words . (See

Table 1-2 C++ Key Words on page 16).

Compilers and Interpreters

Compiler - a program that translates a highlevel language into a separate machine language program. The machine language program (.exe file) can then be executed any time it is needed without recompiling. (page 17)

(See Figure 1.17 Compiling a High-level program and executing it on page 18)

Interpreter - a program that both translates and executes the instructions in a high-level program. As the interpreter reads each individual instruction in the program, it converts it to a machine language instruction and then immediately executes it. (page 17) (See Figure

1-18 Executing a High-Level program with an interpreter on page 18).

1.5 C++ and the App Game Kit Library

CONCEPT: C++ is a high-level programming language, and the App Game Kit provides a library of prewritten code that can be used in C++ to write games and graphical programs. (page 19)

Know the history of C and C++ including Bell

Labs, Dennis Ritchie, and Bjarne Stroustrup.

(pages 19 - 20)

Core Language – set of key words with a specific meaning to perform essential operations. (page 20)

Library - a collection of code that has already been written for a specific purpose. The Dark

GDK library is a collection of code that can be used with C++ for handling graphics and writing game programs. (page 20)

Visual Studio 2010 – In the Spotlight

Solution file – one or more project files (.sln extension) This is the file you open in Visual

Studio.

Project file – contains one or more program files (.vcproj extension)

C++ program file – contains the C++ program code. This is the most important file. (.cpp extension)

Header file - The header file tells the compiler what is available in your library. The header file is where the interface specification is stored.

(.h extension)

Solution Explorer - the pane in Visual Studio that displays all the files used in a program

Program Editor - the pane in Visual Studio where you edit the C++ code

Start Page - the start up page that displays information about Visual Studio such as updates and releases, articles and news.

ITP 134 - Mrs. Eaton Chapter 1 Study Guide – 2 nd Edition Page 2

Download