Lecture 6 Flashcards

1
Q

Code Library

A

Allow you to have additional functionality by letting you access functions on that file. Libraries typically include a header and implementation file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Header file

A

Contains definitions and declarations for functions in the library and shows you how to access those functions.

Typically includes the extension .hpp or .h. Extension not needed when using libraries from the c++ standard library since the extension is implied.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Implementation file

A

Includes commands and details. Typically includes the extension .c or .cpp. Extension not needed if it is part of the c++ standard library.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

.h or .hpp

A

Extension for header file. Pp stands for plus plus

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

.c or .cpp

A

Extension for implementation file. Pp stands for plus plus.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Benefits to using libraries

A
  1. Separation of ideas in code
  2. Reuse code in libraries so you don’t have to come up with it again.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Object file

A

Machine instructions that the program, header, and implementation files are each compiled in to.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

include

A

Allows you to access a library when followed by the library name in <> or “”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

include convention

A

<> for c++ standard libraries
“” for other libraries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Linker

A

Combines the object file from the main program with the library’s object file to make an executable file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Executable file

A

File that has all the information needed from both the program file and the library file. Can run on it’s own.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When are libraries compiled?

A

Ahead of time–if you write your own, you will need to compile it ahead of time as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

C++ Standard Libraries

A

Libraries that come with C++ download

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Common standard libraries

A

Cmath, ctime, iostream, cstdlib

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Function

A

Made of function name followed by arguments in parentheses and commands that follow in curly braces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Function call

A

When the name of the function followed by the arguments in parentheses appears in the code. Function call is replaced by the value returned by the function.

17
Q

Pseudorandom numbers

A

Numbers generated to appear random since it is difficult for deterministic computers to generate completely random numbers.

18
Q

Rand()

A

Function that generates random numbers (needs cstdlib)

19
Q

Srand()

A

Sets the seed for pseudo random number generation

20
Q

Time()

A

Gives the current time. Needs ctime library. Is great for pseudorandom seed generation. The argument needs to be set to 0

21
Q

Seed value

A

The argument for srand(). Number from which the pseudorandom numbers will be generated.

22
Q

How to get a random number between 1 and some number

A

Use the modulus operator for some number and add 1

23
Q

Boost Libraries

A

Includes libraries that have been extensively tested and are safe to use. Some boost libraries have been added to the C++ Standard Libraries. Found at boost.com

24
Q

Pow()

A

The power function takes the arguments number and power the number should be taken to

25
Q

Www.cplusplus.com

A

Reference for libraries and functions you don’t know