Lecture 9 Flashcards

1
Q

Literals

A

Specific fixed values of some type

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

Concatenation

A

When two things are combined without any spaces. + is the concatinatuon operator for string type variables.

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

Overload

A

When an operator has a different meaning for different variable types (e.g. + is concatenate for srings and addition for integers)

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

Operator overload

A

When an operator is overloaded

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

Append

A

When something is added to the end.

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

Strings

A

Variable type with text. String library needs to be #included. Text needs to be enclosed in double quotations.

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

Getline function

A

Allow us you to input data to a string type variable in the form:
Getline(in, variable name)

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

Rules for adding string literals and variables

A

Two string variables or a string variable and literal can be used, but adding two string literals may result in an error.

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

Char

A

Character variable type. Is a single number, letter, symbol, etc. Does not need to be #included. Value only needs to be enclosed in one quotation mark.

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

String relationship to vectors

A

Strong is an array or vector of characters with 0 in the last element to indicate the end of the string. This is why they can’t be added.

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

String functions

A

At and size can be used as well as length.

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

How strings are compared

A

Each character is compared and the first characters that are different are analyzed based on their ASCII number. The larger number is considered greater.

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

String member functions

A
  1. Empty() returns true if string is empty
  2. Find() searches for a string in another string and returns the location
  3. Substr() takes in arguments for starting position and length and returns the string at that location
  4. Replace() replaces part of a string with another string.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly