Introduction to Computers and C++ Programming

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/84

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

85 Terms

1
New cards

Computer program

A set of instructions for a computer to follow.

<p>A set of instructions for a computer to follow.</p>
2
New cards

Computer software

The collection of programs used by a computer.

3
New cards

PCs (Personal Computer)

Relatively small computers used by one person at a time.

4
New cards

Workstation

Larger and more powerful than a PC.

5
New cards

Mainframe

Still larger than a workstation, requires support staff, and is shared by multiple users.

6
New cards

Networks

A number of computers connected to share resources, printers, devices, and information.

7
New cards

Input devices

Allows communication to the computer.

8
New cards

Output devices

Allows communication to the user.

9
New cards

Processor (CPU)

The main component that follows program instructions.

10
New cards

Main memory

Memory locations containing the running program.

<p>Memory locations containing the running program.</p>
11
New cards

Secondary memory

Permanent record of data often on a disk.

12
New cards

Binary Digit or Bit

A digit that can only be zero or one.

13
New cards

Byte

Each memory location has eight bits.

14
New cards

Address

Number that identifies a memory location.

15
New cards

Larger Data Items

Some data is too large for a single byte; most integers and real numbers are too large.

16
New cards

Data or Code

Interpretation of binary data depends on the current instruction.

17
New cards

File

Stores data or instructions in secondary memory.

18
New cards

Hard disk

Fast secondary memory, fixed in the computer and not normally removed.

19
New cards

Floppy disk

Slow secondary memory, easily shared with other computers.

20
New cards

Compact disk

Slower than hard disks, easily shared with other computers, can be read only or re-writable.

21
New cards

Random Access

Usually called RAM, allows the computer to directly access any memory location.

22
New cards

Sequential Access

Data is generally found by searching through other items first, more common in secondary memory.

23
New cards

Central Processing Unit (CPU)

Typically called the CPU, follows program instructions and performs operations like add, subtract, multiply, divide, and move data from location to location.

24
New cards

Operating System

A program that allows us to communicate with the computer, allocates the computer's resources, and responds to user requests to run other programs.

<p>A program that allows us to communicate with the computer, allocates the computer's resources, and responds to user requests to run other programs.</p>
25
New cards

Common Operating Systems

Examples include UNIX, Linux, DOS, Windows, Macintosh, and VMS.

26
New cards

Computer Input

Consists of a program and some data.

27
New cards

High-level Languages

Programming languages that resemble human languages and are designed to be easy to read and write.

28
New cards

Examples of High-level Languages

C, C++, Java, Pascal, Visual Basic, FORTRAN, Perl, PHP, Lisp, Scheme, Ada, C#, Python.

29
New cards

Translation of High-level Languages

High-level languages must be translated to zeros and ones for the CPU to execute a program.

30
New cards

Low-level Languages

Languages that include assembly language, which must be translated to machine language (zeros and ones).

31
New cards

Assembly Language Command

An example is ADD X Y Z, which means add the values found at x and y in memory, and store the result in location z.

32
New cards

Machine Language

The language that the CPU can follow, represented in binary (e.g., 0110, 1001, 1010, 1011).

33
New cards

Compilers

Programs that translate high-level language to machine language.

34
New cards

Source Code

The original program written in a high-level language.

35
New cards

Object Code

The translated version of the source code in machine language.

36
New cards

Linkers

Programs that combine object code for the programs we write and object code for pre-compiled routines into a machine language program.

37
New cards

First Programmable Computer

Designed by Charles Babbage, began work in 1822, but was not completed in his lifetime.

38
New cards

First Programmer

Ada Augusta, Countess of Lovelace, a colleague of Babbage.

39
New cards

Algorithm

A sequence of precise instructions that leads to a solution.

40
New cards

Program

An algorithm expressed in a language the computer can understand.

41
New cards

Program Design Process

Includes the Problem Solving Phase and Implementation Phase.

<p>Includes the Problem Solving Phase and Implementation Phase.</p>
42
New cards

Problem Solving Phase

Involves specifying the task completely, determining input and output, organizing output, and developing the algorithm before implementation.

43
New cards

Testing the Algorithm

Experience shows that testing the algorithm for correctness saves time in getting your program to run.

44
New cards

Implementation Phase

Translate the algorithm into a programming language.

45
New cards

Compile

Locates errors in using the programming language.

46
New cards

Run the program

Verify correctness of results.

47
New cards

Object Oriented Programming

Abbreviated OOP, used for many modern programs.

48
New cards

Encapsulation

Objects contain their own data and algorithms.

49
New cards

Inheritance

Objects can inherit characteristics from other objects.

50
New cards

Polymorphism

A single name can have multiple meanings depending on its context.

51
New cards

Software Life Cycle

Analysis and specification of the task (problem definition).

52
New cards

C++

Derived from the C language.

53
New cards

C

Developed by Dennis Ritchie at AT&T Bell Labs in the 1970s.

54
New cards

C++ History

C++ developed by Bjarne Stroustrup at AT&T Bell Labs in the 1980s.

55
New cards

Sample C++ Program

A simple C++ program begins with #include .

<p>A simple C++ program begins with #include <iostream>.</iostream></p>
56
New cards

Variable Declaration

Identifies names of three variables to name numbers.

57
New cards

cout

Used for output to the monitor.

58
New cards

cin

Used for input from the keyboard.

59
New cards

Computation

Performs a computation using the '*' operator for multiplication.

60
New cards

Program Layout

Compiler accepts almost any pattern of line breaks and indentation.

61
New cards

Program Formatting

Programmers format programs so they are easy to read.

62
New cards

Braces Placement

Place opening brace '{' and closing brace '}' on a line by themselves.

63
New cards

Statement Indentation

Indent statements.

64
New cards

Single Statement per Line

Use only one statement per line.

65
New cards

Variable Declaration Location

Typically variables are declared at the beginning of the program.

66
New cards

Statement Terminator

Statements (not always lines) end with a semi-colon.

67
New cards

Include Directives

#include tells compiler where to find information about items used in the program.

<p>#include <iostream> tells compiler where to find information about items used in the program.</iostream></p>
68
New cards

iostream Library

iostream is a library containing definitions of cin and cout.

69
New cards

Namespace Usage

using namespace std; tells the compiler to use names in iostream in a 'standard' way.

70
New cards

Main Function Start

To begin the main function of the program, use int main() {.

71
New cards

Main Function End

To end the main function, use return 0;.

72
New cards

C++ Source Code

C++ source code is written with a text editor.

73
New cards

Compiler Function

The compiler on your system converts source code to object code.

74
New cards

Linker Function

The linker combines all the object code into an executable program.

75
New cards

C++11

C++11 (formerly known as C++0x) is the most recent version of the standard of the C++ programming language.

76
New cards

C++11 Approval Date

Approved on August 12, 2011 by the International Organization for Standardization.

77
New cards

C++11 Compiler Compatibility

C++11 language features are not supported by older compilers.

78
New cards

Compiling C++11

Check the documentation with your compiler to determine if special steps are needed to compile C++11 programs.

79
New cards

g++ Extra Flags

With g++, use extra flags of -std=c++11.

80
New cards

Running a Program

Obtain code in Display 1.10, compile the code, fix any errors the compiler indicates and re-compile the code, then run the program.

81
New cards

Bug

A mistake in a program.

82
New cards

Debugging

Eliminating mistakes in programs.

83
New cards

Logic Errors

Errors in the program's algorithm that are most difficult to diagnose.

84
New cards

Syntax Errors

Violation of the grammar rules of the language discovered by the compiler.

85
New cards

Run-time Errors

Error conditions detected by the computer at run-time.