C++

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

- faster

"switch" statements fun ______ so should probably be used whenever possible.

- atol example: lnum = atol("500000");

#include <cstdlib> : _________ -Accepts a C-string as an argument. The function converts the C-string to a long integer and returns that value.

- atoi example: num = atoi("4569");

#include <cstdlib> : __________ -Accetps a C-string as an argument. The function converts the C-string to an integer and returns that value.

- atof example: fnum = atof("3.14159");

#include <cstdlib> : ____________ - Accepts a C-string as an argument. The function converts the C-string to a double and returns that value.

- itoa example: itoa(value, string, base);

#include <cstdlib> : _________________ - Converts an integer to a C-string. The first argument, value, is the integer. The result will be stored at the location pointed to by the second argument, string. The third argument, base, is an integer. It specifies the numbering system that the converted integer should be expressed in (8 = octal, 10 = decimal, 16 = hexadecimal, etc.).

- strstr example: cout << strstr(string1, string2);

#include <cstring> : Accepts two C-strings or pointers to two C-strings as arguments. Searches for the first occurrence of string2 in string1. If an occurrence of string2 is found, the function returns a pointer to it. Otherwise, it returns a NULL pointer (address 0).

- strcpy

#include <cstring> : The strncpy function allows you to copy a specified number of ______________ - characters from a string to a destination. Calling the strncpy is similar to calling _______, except you pass a third argument specifying the maximum number of characters from the second string to copy to the first.

- strcat example: strcat(string1, string2);

#include <cstring> : __________ -Accepts two C-strings or pointers to two C-strings as arguments. the function appends the contents of the second string to the first C-string. (The first string is altered, the second string is left unchanged.)

- type - type

A data structure creates a new ______: Once a data structure is declared, a new ______ can be used in the rest of the program as if it was any other type.

null-terminated

A file stream object's open member function will not accept a string object as an argument. The open member function requires that you pass the name of the file as a _______ string, which is also known as a C-string.

prototype

A function ________ eliminates the need to place a function definition before all calls to the function.

nested loop

A loop that is inside another loop is called a __________.

- global - local

If an array is defined _________, all of its elements are intialized to zero by default. _______ arrays, however, have no default initialization value.

- less than

If one address comes before another address in memory, the first address is considered "_________" the second. C++'s relational operators may be used to compare pointers.

L prefix example: L"this is a wide character string"

If one wants a string literal to be explicitly made of wide characters (wchar_t type), instead of narrow characters (char type), he can precede the constant with the ___ prefix.

- overflow the boundaries

If the array holding the first string isn't large enough to hold both strings, strcat will ______________ of the array.

commas -example: int a, b, c;

If you are going to declare more than one variable of the same type, you can declare all of them in a single statement by separating their identifiers with commas.

follow it

If you leave an element uninitialized, you must leave all the elements that __________ uninitialized as well. C++ does not provide a way to skip elements in the initialization list.

parentheses

If you specify a starting size for a vector, the size declarator is enclosed in _________, not square brackets.

- reference

If you want to change the value in a vector argument, it must be passed into a __________ parameter.

- else Its form used in conjuction with if is: if (condition) statement1 else statement2

When using the ( if ) keyword we can specify what we want to happen if the condition is not fulfilled by using the keyword _______.

constants - case 1 case 2 case 3

When using the switch statement we can only compare an expression against ______. Therefor we cannot put variables as labels; or ranges.

default ( default: ) - This is comparable to the " else " branch of an " if " statement.

When using the switch statement, place a _______ branch to handle a situation in which the input does not relate to any of the defined case branches.

&

When we precede the name of a variable with the reference operator (___) we are no longer talking about the content of the variable itself, but about its reference (i.e., its address in memory).

*(array + index)

When working with arrays, remember the following rule: array[index] is equivalent to ___________

first dimension

When writing functions that accept multi-dimensional arrays as arguments, all but the _______________ must be explicitly stated in the parameter list.

- strncat example: strncat(string1, string2, n);

#include <cstring> : ____________ -Accepts two C-strings or pointers to two C-strings, and an integer argument. the third argument, an integer, indicates the maximum number of characters to copy from the second C-string to the first C-string.

- strlen example: length = strlen(someCString);

#include <cstring> : ______________ - Accepts a C-string or a pointer to a C-string as an argument. Returns the length of the C-string (not including the null terminator.)

- strcpy example: strcpy(string1, string2);

#include <cstring> : ______________ -Accepts two C-strings or pointers to two C-strings as arguments. The function copies the second C-string to the first C-string. The second C-string is left unchanged.

- False - True

( (5==5) && (3 > 6) ) // evaluates to _______ (true && false). ( (5==5) || (3 > 6) ) // evaluates to _______ (true && false).

stub

A ______ is a dummy function that is called instead of the actual function it represents. It usually displays a test message acknowledging that it was called, and nothing more.

- block - block

A ______ is a group of statements which are separated by semicolons (;) like all C++ statements, but grouped together in a _______ enclosed in braces: { }: { statement 1; statement 2; statement 3; }

- null - zero example: int * p; p = 0; // p has a null pointer value

A ______ pointer is a regular pointer of any pointer type which has a special value that indicates that it is not pointing to any valid reference or memory address. This value is the result of type-casting the integer value ______ to any pointer type.

driver

A _______ can be used to thoroughly test a function. It can repeatedly call the function with different test values as arguments. When the function performs as desired, it can be placed into the actual program it will be part of.

- driver - driver - driver

A _______ is a program that tests a function by simply calling it. If the function accepts arguments, the _______ passes test data. If the function returns a value the _________ displays the return value on the screen.

- reference - reference - reference

A _______ variable is an alias for another variable. Any changes made to the _________ variable are actual performed on the variable for which it is an alias. By using a ______ variable as a parameter, a function may change a variable that is defined in another function.

- data structures - members example: struct structure_name { member_type1 member_name1; member_type2 member_name2; ect. . . } object_names;

A __________ is a group of data elements grouped together under one name. These data elements, known as _______, can have different types and different lengths.

- parameters - type (an overloaded function is when you create two functions with the same name)

A function cannot be overloaded only by its return type. At least one of its _______ must have a different ______.

return

A function's _______ value is not part of it's function signature.

earliest occurrence

A function's default arguments should be assigned in the _____________ of the function name. This will usually be the function prototype.

null pointer

A pointer that contains the address 0 is called a __________.

- constant item - pointer itself

A pointer to const points to a ___________. The data that the pointer points to cannot change, but the pointer itself can change. With a const pointer, it is the _________ that is constant. Once the pointer is initialized with an address, it cannot point to anything else.

- body - semicolon (;)

A prototype declaration is identical to a function definition, except that it does not include the _________ of the function itself and instead of that we end the prototype declaration with a mandatory _________.

- literal - constant

A string _______ or string ________ is enclosed in a set of double quotation marks ( " " ).

type name [#of_elements];

A typical declaration for an array in C++ is:_____________

point to

A variable which stores a reference to another variable is called a pointer. Pointers are said to "_________" the variable whose reference they store.

using namespace std;

All of the elements of the standard C++ library are declared with what is called with this command.

void

Although almost non-existent in actual practice the _______ type can be used to point to an unspecified variable. It can be used to point to an int, bool, etc.

- as is example: cout << toupper('*'); // displays *

Any nonletter argument passed to toupper is returned _________.

- value - address

At some moment we may need to pass an array to a function as a parameter. In C++ it is not possible to pass a complete block of memory by _______ as a parameter to a function, but we are allowed to pass its _________. In practice this has almost the same effect and it is a much faster and more efficient operation.

any size

Because a function will accept an array of ________ it may be useful to pass along with the array the number of elements so the function can be designed to stay within range.

reference

Because functions can only pass back one return value you can pass arguments by _________ to assign values into the first function.

nothrow example: int * bobby; bobby = new (nothrow) [5]; if (bobby == 0) { take measures for error };

By using a special object called a ______, we can determine if a memory allocation fails and/or take actions to deal with it.

- typedef example: typedef existing_type new_type_name ;

C++ allows the definition of our own types based on other existing data types. We do this using the keyword ________.

- null terminator

C++ performs no array bounds checking. Make sure the array whose address is passed to itoa is large enough to hold the converted number, including the ___________.

a = a - 5

Compound Assignments: The expression ( a -= 5; ) is equal to ______________.

a = a / b;

Compound Assignments: The expression ( a /=b; ) is equal to _______________.

bool

Data Types: Command for a boolean value. It can take one of two values: true or false. 1 byte in size. Range: true or false.

char

Data Types: Command for a character or small integer. 1 byte in size. Range: Signed = -128 to 127; unsigned = 0 to 255.

double

Data Types: Command for a double precision floating point number. Size is 8 bytes. Range +/- 1.7e +/- 308 (~15 digits)

come after

Default arguments: When an argument is left out of a function call, all arguments that _________ it must be left out as well.

- null - void

Do not confuse null pointers with void pointers. A _____ pointer is a value that any pointer may take to represent that it is pointing to "nowhere", while a ______ pointer is a special type of pointer that can point to somewhere without a specific type. One refers to the value stored in the pointer itself and the other to the type of data it points to.

debugging problems

Don't get carried away with using reference variables as function parameters. Any time you allow a function to alter a variable that's outside the function, you are creating potential _______________. Reference variables should only be used as parameters when the situation requires them.

must have

Each parameter variable in a parameter list ________ a data type listed before its name.

- subscript - subscript

Even though an entire array has only one name, the elements may be accessed and used as individual variables. This is possible because each element is assigned a number known as a _________. A _______ is used as an index to pinpoint a specific element within an array.

- type - type (this is the type of the datum that will be returned by the function with the return statement)

Functions: You will see that the declaration of a function begins with a ______, that is the ____ of the function itself.

- identifiers - type specifiers (the inclusion of a name for each parameter as in the function definition is optional in the prototype declaration)

In a prototype declaration the parameter enumeration does not need to include the ________, but only the ________.

any other

Individual array elements are processed like _______ type of variable.

c-like initialization example: int a = 0;

Initialization of variables: _____ initialization is done by appending an equal sign followed by the value to which the variable will be initialized.

constructor initialization example: initial value of a = 0 int a (0);

Initialization of variables: ______ initialization is done by enclosing the initial value between parentheses.

- data type

It's important to know that pointers do not work like regular variables when used in mathematical statements. In C++, when you add a value to a pointer, you are actually adding that value times the size of the _________ being referenced by the pointer.

#

Lines beginning with a ____ sign are directives for the preprocessor. They are not regular code lines with expressions but indications for the compiler's preprocessor.

- u - l examples: 75 // int 75u // unsigned int 75l // long 75ul // unsigned long

Literal constants, like variables, are considered to have a specific data type. By default, integer literals are of type int. However, we can force them to either be unsigned by appending the __ character to it, or long by appending and __ character.

- && - || - !

Logical Operators: 1. And: P ___ Q 2. Or: P ___ Q 3. Not: __ P

already

Most compilers _______ optimize code to generate inline functions when it is more convenient.

sequentially (for an array of three dimensions the first location would be 0,0,0)

Multidimensional arrays are actually stored _________ for instance in a two dimensional array. 0,0 | 0,1 | 0,2 | 1,0 | 1,1 | 1,2 | 2,0 | 2,1 | 2,2 | etc. . .

factor

Multidimensional arrays are just an abstraction for programmers, since we can obtain the same results with a simple array just by putting a ______ between the indices.

as many indices as needed

Multidimensional arrays are not limited to two indices. They can contain _________. But be careful! The amount of memory needed for an array rapidly increases with each dimension.

abbreviated example: namespace NLNN = NLongNameSpaceName;

Namespaces can be ___________ to shorten long names.

other namespaces

Namespaces can contain variables, functions, or even __________________.

dot ( . ) Example: apple.weight apple.price

Once we have declared objects of a determined structure type; we can operate directly with their members. To do that we use a ______ inserted between the object name and the member name.

- delete - delete

Only use pointers with _______ that were previously used with new. if you use a ointer with _______ that does not reference dynamically allocated memory, unexpected problems could result.

- literal - constant

Only variables may be passed by reference. If you attempt to pass a nonvariable argument, such as a _______, a _________, or an expression, into a reference parameter, an error will result.

also available

Operators "new" and "delete" are exclusive of C++. They are not available in the C language. But using pure C language and its library, dynamic memory can also be used through the functions: malloc, calloc, realloc and free. Which are _________ in C++ including the <cstdlib> header file.

- can - cannot (tip: this allows to move along an array using the increment or decrement operators)

Pointers _______ be reassigned whereas references _______.

function call

Reference variables: The ampersand must appear in both the prototype and the header of any function that uses a reference variable as a parameter. It does not appear in the ___________.

- declaration - reassigned

References (&): 1. Must be initialized at ___________ 2. Cannot be ________

Not equal to example: ( 3 != 2 ) // evaluates to true

Relational and equality operators: != means __________.

Greater than or equal to

Relational and equality operators: >= means __________.

- 2 ( For example, a maximum of 16 comparisons will be made on an array of 50,000 elements (2^16 = 65,536), and a maximum of 20 comparisons will be made on an array of 1,000,000 elements (2^20 = 1,048,576). )

Searching arrays: Powers of ____ are used to calculate the maximum number of comparisons the binary search will make on an array of any size.

right-hand -This is mostly important when the right-hand expression has side effects, such as altering values.

Short-Circuit: for the && logical operator If the left-hand side expression is false, the combined result is false (________ side expression is not evaluated)?

- type name - variable name example: int* pointerVariable;

Some programmers prefer to define pointers with the asterisk next to the _______, rather than the _________. This style of definition might visually reinforce the fact that the pointer does not hold actually hold the data type but points to that type of data.

- const

Sometimes you want a function to be able to modify the contents of an array that is passed to it as an argument, and sometimes you don't. You can prevent a function from making changes to an array argument by using the _______ key word in the parameter declaration.

backslash sign (\)

String literals can extend to more than a single line of code by putting a ________ at the end of each unfinished line.

c_str example: inputFile.open(filename.c_str());

String objects have a member function named ______ that returns the contents of the object formatted as a null-terminated C-string.

nested

Structures can also be ________ so that a valid element of a structure can also be in its turn another structure.

- zero ( The subscript of the last element in an array is one less than the total number of elements in the array.

Subscript numbering in C++ always starts at ______.

break

The "switch" statement is a bit peculiar within the C++ language because it uses labels instead of blocks. This forces us to put _______ statements after the group of statements that we want to be executed for a specific condition.

semicolon ( ; )

The #define directive is not a C++ statement but a directive for the preprocessor; therefore it assumes the entire line as the directive and does not require a _______ at its end. If you append a __________ at the end, it will also be appended in all occurrences of the identifier within the body of the program that the preprocessor replaces.

num1 is evenly divisible by num2 ( 0 is considered a "true" value )

The % operator divides one number by another, and returns the remainder of the division. In an expression such as num1 % num2, the % operator will return 0 if ___________________.

string example: #include <string> string mystring = "This is my string";

The C++ language library provides support for strings through the standard _______ class.

- cstring example: #include <cstring>

The C++ library has numerous functions for handling C-strings. These functions perform various tests and manipulations, and require that the ___________ header file be included.

- cstdlib

The C++ library provides functions for converting a C-string representation of a number to a numeric data type and vice versa. These functions require the ________ header file to be included.

- cctype

The C++ library provides several functions for testing characters. To use these functions you must include the ________ header file.

- plain arrays - char

The C++ standard library implements a powerful string class, which is very useful to handle and manipulate strings of characters. However, because strings are in fact sequences of characters, we can represent them also as __________ of _____ elements.

- modulus example: 12345 % 10 is equal to 5 12345 % 100 is equal to 45 12345 % 1000 is equal to 345

The ____ operator can be used to extract the last digits from a number.

do-while loop

The ______ loop is usually used when the condition that has to determine the end of the loop is determined within the loop statement itself.

do-while

The ______ loop must be terminated with a semicolon. Even with multiple statements.

The While Loop - while (expression) statement

The ______ loops functionality is simply to repeat a statement while the condition set in expression is true.

comma operator (,) example: a = (b=3, b+2);

The ______ operator is used to separate two or more expressions that are included where only one expression is expected.

the do-while loop

The _______ loop is a conditional loop. It is ideal in situations where you always want the loop to iterate at least once. It is a good choice for repeating a menu.

do-while loop - do statement while (condition)

The _______ loop is exactly the same as the while loop, except that condition in the do-while loop is evaluated after the execution of statement instead of before, granting at least one execution of statement even if condition is never fulfilled.

binary

The ________ search is a clever algorithm that is much more efficient than the linear search. Its only requirement is that the values in the array be sorted in order. Instead of testing the array's first element, this algorithm starts with the element in the middle. If that element happens to contain the desired value, then the search is over. Otherwise, the value in the middle element is either grater than or less than the value being searched for. If it is greater, then the desired value will be found somewhere in the first half of the array. If it is less, then the desired value will be found somewhere in the last half of the array. This process repeats until the element if found if it is contained in the array.

assigns a value to a variable example: a = 5;

The assignment operator ( = ): ________________.

>>

The bitwise operator __ has an asm equivalent of SHR. Description: Shift Right

&

The bitwise operator ___ has an asm equivalent of AND. Description: Bitwise AND.

~

The bitwise operator ___ has an asm equivalent of NOT. Description: Unary complement (bit inversion)

<<

The bitwise operator ___ has an asm equivalent of SHL. Description: Shift Left

|

The bitwise operator ____ has an asm equivalent of OR. Description: Bitwise Inclusive OR

value on the left plus increase on the right. - value += increase; - b += 5; // b is equal to (b + 5)

The compound assignment ( += ) is equivalent to ____________.

? example: 7==5 ? 4 : 3 // returns 3, since 7 is not equal to 5.

The conditional operator ___ evaluates an expression returning a value if that expression is true and a different one if the expression is evaluated as false.

constant non-dynamic

The elements field within brackets [ ] which represents the number of elements an array is going to hold, must be a _______ value, since arrays are blocks of _________ memory whose size must be determined before execution.

- only once - increase - 2

The for loop: for (initialization; condition; increase) statement; 1. initialization is executed _______? 2. condition is checked. If it is true the loop continues, otherwise the loop ends and "statement" is skipped. 3. "statement" is executed. 4. Finally, whatever is specified in the ______ field is executed and the loop gets back to step ____.

- ++ - -- examples: b=3; A=++B; // A and B both contain 4 A=B++; // A contains 3 and B contains 4

The increase operator (___) and the decrease operator (___) increase or reduce by one the value stored in a variable. They are equivalent to +=1 and -=1, respectively.

++

The increment operator is ____. it can be prefix or postfix. If we use the prefix then incrementation takes place before the command or output.

more than once example: cout << "hello, I am " << age << "years old and my zipcode is " << zipcode;

The insertion operator (<<) may be used ________ in a single statement.

Signed or unsigned -examples: unsigned short int NumberOfSisters; signed int MyAccountBalance;

The integer data types char, short, long and int can be either ______ or ______ depending on the range of numbers needed to be represented. _____ types can represent both positive and negative values, whereas ______ types can only represent positive values (and zero).

&& example: a b a&&b true true true true false false false true false false false false

The logical operator ___ corresponds with Boolean logical operation AND.

|| example: a b a||b true true true true false true false true true false false false

The logical operator ____ corresponds with Boolean logical operation OR. This operation results true if either one of its two operands is true, thus being false only when both operands are false themselves.

- individual elements example: for (int count = 0; count < SIZE; count++) newValues[count] = oldValues[count];

The only way to assign one array to another is to assign the ______________ in the arrays. Usually, this is best done with a loop.

- lvalue (left value) - rvalue (right value) - lvalue - rvalue - right-to-left rule

The part of the left of the assignment operator (=) is known as the _______ and the right one as the __________. The _______ has to be a variable whereas the _________ can be either a constant, a variable, the result of an operation or any combination of these. The most important rule when assigning is the ___________ rule: the assignment operation always takes place from right to left, and never the other way.

- beginning memory address ( you cannot change the starting memory address of an array. ) explained on page 396 in Starting out with C++.

The reason the assignment operator will not work with an entire array at once is complex, but important to understand. Anytime the name of an array is used without brackets and a subscript, it is seen as the array's _______________.

- local variables - cannot (Global variable, those not inside a function, can be used anywhere after there declaration.

The scope of variables declared within a function (_________) or any other inner block is only their own function or their own block and ________ be used outside of them

::

The scope resolution operator is ____? It allows the use of a global variable in a local block when there is a local variable of the same name.

<sstream> For example, if we want to extract an integer from a string we can write: string mystr ("1204"); int myint; stringstream(mystr) >> myint;

The standard header file ________ defines a class called strengstream that allows a string-based object to be treated as a stream.

no effect

The value passed as argument to "delete" must be either a pointer to a memory block previously allocated with "new," or a null pointer (in the case of a null pointer, "delete" produces ________).

- parameters ( There are several variations of these terms in use. Some call the arguments actual parameters and call the parameters formal parameters. Others use the terms actual argument and formal argument. )

The values that are passed into a function are called arguments, and the variables that receive those values are called ________.

- Pointers - Pointers

The variable that stores the reference to another variable is what we call a _______. ______ are a very powerful feature of the C++ language that has many uses in advanced programming.

type name [#down] [#across]

The way to declare a bidemensional array would be: __________________

true and false

There are only two valid boolean values: ______ and _____.

//

This is a comment line. All lines beginning with _____are consideredcomments and do not have any effect on the behavior of the program.

cout <<

This line is a C++ statement. _____ is the name of the standard ouput stream in C++, and the meaning of the entire statement is to insert a sequence of characters

earlier point (an alternative is to declare a prototype)

To be able to call a function it must have been declared in some ___________ of the code.

- clear example: vectorName.clear();

To completely clear the contents of a vector, use the ______ member function.

addition and subtraction

To conduct arithmetical operations on pointers is a little different than to conduct them on regular integer data types. Only ________ and ________ operations are allowed to be conducted with them, the others make no sense in the world of pointers.

- empty example: if (vectorName.empty()) cout << "No values in vectorName.\n" ;

To determine if a vector is empty, use the _______ member function.

- modulus ( % ) example: (rand() % 4) will give random values between 0 and 3

To limit numbers in in the rand() function use the ______ operator.

- /n - endl;

To make a line break use the ___ command or the ____ command.

ampersand sign & example: void duplicate (int& a, int&b) { }

To pass a variable into a function by reference instead of by value use the ________ after the type of each parameter. (This will allow the second function to actually change the variables in the first function)

- single quotes ( ' ) - double quotes ( " )

To represent a single character we enclose it between _________ and to express a string (which generally consists of more than one character) we enclose it between __________.

cstdlib

To use the exit function, you must include the ________ header file.

#include <vector> ( To use the vector data type, you must have the using namespace std; statement in your program. )

To use vectors in your program, you must include the vector header file with the following statement: ______________________

- parameter lists - overloading

Two or more functions may have the same name, as long as their ____________ are different. This is called _________ a function.

- subscript - size declarator - subscript

Understand the difference between the array size declarator and a _______. The number inside the brackets of an array definition is the __________. The number inside the brackets of an assignment statement or any statement that works with the contents of an array is a ________.

- size example: numValues = vectorName.size();

Unlike arrays, vectors can report the number of elements they contain. This is accomplished with the ______ member function.

- break - continue

Use the ______ and ______ statements with great caution. because they bypass the normal condition that controls the loop's iterations, these statements make code difficult to understand and debug.

- pop_back example: vectorName.pop_back();

Use the _________ member function to remove the last element from a vector.

getline(cin, variable);

User inputs: The ______ function reads an entire line, including leadiong and embedded spaces, and stores it in a string object.

- globally - multiple

Using a namespace is way to use variables ________ even when there may be ________ variable of the same name.

asterisk (*) example: beth = *ted;

Using a pointer we can directly access the value stored in the variable which it points to. To do this, we simply have to precede the pointer's identifier with an __________, which acts as dereference operator and that can be literally translated to "value pointed by".

bad practice - If each namespace contains a variable of the same name an error will occur.

Using namespaces in the global scope is generally ____________.

more than one example: for ( n=0, i=100 ; n!=i ; n++, i-- ) { //whatever here }

Using the comma operator (,) we can specify __________ expression in any of the fields included in a for loop.

arguments

Values that are sent into a function are called _________.

- ASCII table - Unicode table

Variables in the "char" type correspond to the ______ table. Variables in the "wchar_t" type correspond to the _______ table.

- swap(vector2) example: vector1.swap(vector2); ( This statement swaps the contents of vector1 and vector2. )

Vector Member Functions: ________ - Swaps the contents of two vectors.

- resize(elements, value) example: vectorName.resize(5, 1); ( This statement increases the size of vectorName by five elements. The five new elements are initialized to the value of 1. )

Vector Member Functions: _________ - Resizes a vector by elements. Each of the new elements is initialized with default value.

/* and */

What are the markers for multi-line comments.

x is a pointer to an integer. y and z are both integers ( The same as: int *x,y,z; )

What does the following represent? int* x,y,z;

c = c % 3;

What is the expression: c %= 3; equal to?

- static_cast<new_datatype>(variable); ( older methods include: variable = (int)variable / variable; variable = int(variable) / variable; )

What is the preferred C++ method of typecasting?

hidden

When a block is nested inside another block, a variable defined in the inner block may have the same name as a variable defined in the outer block. As long as the variable in the inner block is visible, however, the variable in the outer block will be ____________.

delete

When a program is finished using a dynamically allocated chunk of memory, it should release it for future use. The _________ operator is used to free memory that was allocated with new.

columns

When a two-dimensional array is passed to a function, the parameter type must contain a size declarator for the number of _________.

reference

When a variable is passed by ________ we are not passing a copy of its value, but we are somehow passing the variable itself to the function and any modification that we do to the local variables will have an effect in their counterpart variables passed as arguments in the call to the function.

- *name - *(name+1)

When accessing dynamic memory (or an array) the first element can be accessed with the expression name[0] or the expression ________. The second element can be accessed either with bobby[1] or __________.

- element - same type

When adding one to a pointer wet are making it to point to the following _______ of the _________ with which it has been defined, and therefore the size in bytes of the type pointed is added to the pointer.

do not

When an argument is passed into a parameter, only a copy of the argument's value is passed. Changes to the parameter _______ affect the original argument.

- reference - starting memory address

When an entire array is passed to a function, it is not passed by value, but passed by ___________. Imagine the CPU time and memory that would be necessary if a copy of a 10,000-element array were created each time ti was passed to a function! Instead, only the _____________ of the array is passed.

- empty

When an initialization of values is provided for an array, C++ allows the possibility of leaving the square brackets _________. In this case, the compiler will assume a size for the array that matches the number of values included between braces { }.

- not be - undetermined -zeros

When declaring a regular array of local scope, if we do not specify otherwise, its elements will _______ initilized to any value by default, so their content will be ___________ until we store some value in them. The elements of global and static arrays, on the other hand, are automatically initialized with their default values, which for all fundamental types this means they are filled with ________.

c-like initialization and constructor initialization

When declaring a regular local variable, its value is by default undetermined. But you may want a variable to store a concrete value at the same moment that it is declared. In order to do that, you can initialize the variable. There are two ways to do this: _______ and _______.

angled brackets example: vector<int> numbers;

When defining a vector the data type is enclosed in _________, immediately after the word vector. Because the vector expands in size as you add values to it, there is no need to declare a size. You can define a starting size, if you prefer.

data type ( If you have a prototype you still have to put in a data type )

When passing a variable as an argument, simply write the variable name inside the parentheses of the function call. Do not write the ________ of the argument variable in the function call.

non-english

Wide characters are used mainly to represent ________ or exotic character sets.

unions

With _______ all of the elements are referring to the same location in memory, the modification of one of the elements will affect the value of all of them. We cannot store different values in them independent of each other.

const example: const int pathwidth = 100; const char tabulator = '\t'; -Here, pathwidth and tabulator are two typed constants. They are treated just like regular variables except that their values cannot be modified after their definition.

With the ______ prefix you can declare constants with a specific type in the same way as you would do with a variable.

tabulators example: "this forms" "a single" "string" "of characters"

You can concatenate several string constants separating them by one or several blank spaces, ________, newline or any other valid blank character.

- setprecision( num_of_digits) example: cout << setprecision(2) << fixed << variable; ( needs iomanip header )

You can control the number of significant digits with which floating-point values are displayed by using the _________ manipulator.

#define example: #define PI 3.14159 #define NEWLINE '\n'

You can define your own names for constants that you use very often without having to resort to memory-consuming variables, simply by using the _______ preprocessor directive.

- conditional example: expression ? expression : expression; if the first expression is true then do the second, if the first expression is false then do the third.

You can use the _________ operator to create short expressions that work like if/else statements.

Loop example: While (iIndex <4) { iaCopy[iIndex] = iaArray[iIndex]; ++iIndex; } - alternatively use a pointer

You cannot directly copy an array but using a ______ you can copy an array one index at a time.

- memory address - loop example: for (int count = 0; count < SIZE; count++0) cout << array[count] << endl;

You cannot use cout to display an array in quite the same way as a variable because cout will display the array's ____________, not the array's contents. You must use a _______ to display the contents of each of the array's elements.

- beginning memory addresses

You cannot use the == operator with the names of two arrays to determine whether two arrays are equal. When you use the == operator with array names, the operator compares the _________________ of the arrays, not the contents of the arrays.

- push_back - push_back example: vectorName.push_back(25); // will store 25 as the last element

You cannot use the [ ] operator to access a vector element that does not exist. To store a value in a vector that does not have a starting size, or that is already full, use the _______ member function. The ________ member function accepts a value as an argument, and stores that value after the last element in the vector.

- vector syntax ( remember that vectors are passed by value and not reference )

You may sort and search vectors using the same methods as arrays; simply substitute the ___________ for the array syntax when necessary.

zero

_____ represents a Boolean value of False.

unions

______ allow one same portion of memory to be accessed as different data types, since all of them are in fact the same location in memory. Its declaration and use is similar to the one of the structures but its functionality is totally different.

goto - The destinination point is identified by a label, which is then used as an argument for the goto statement. A label is made of a valid identifier followed by a colon (:). if (n>0) goto loop; // then put ( loop: ) somewhere in function.

______ allows one to make an absolute jump to another point in the program. You should use this feature with caution since its execution causes an unconditional jump ignoring any type of nesting limitations.

- exit - exit - exit example: void exit (int exitcode); by convention, an exit code of 0 means that the program finished normally and any other value means that some error or unexpected results happened.

______ is a function defined in the cstdlib library. The purpose of ______ is to terminate the current program with a specific ______ code.

static

_______ local variables are not destroyed when a function returns. They exist for the lifetime of the program, even though their scope is only the function in which they are defined.

bitwise &, |, ^, ~, <<, >>

_______ operators modify variables considering the bit patterns that represent the values they store.

zero

array indices always begin by ________

- tolower

cctype: Returns the lowercase equivalent of its argument.

- toupper

cctype: Returns the uppercase equivalent of its argument.

- isdigit

cctype: Returns true (a nonzero number) if the argument is a digit from 0 through 9. Otherwise it returns 0.

- isalnum

cctype: Returns true (a nonzero number) if the argument is a letter of the alphabet or a digit. Otherwise it returns 0.

- islower

cctype: Returns true (a nonzero number) if the argument is a lowercase letter. Otherwise, it returns 0.

- isprint

cctype: Returns true (a nonzero number) if the argument is a printable character (including a space). Returns 0 otherwise.

- ispunct

cctype: Returns true (a nonzero number) if the argument is a printable character other than a digit, letter, or space. Returns 0 otherwise.

- isspace

cctype: Returns true (a nonzero number) if the argument is a whitespace character. Whitespace characters are any of the following: space ' '; vertical tab '\v'; newline '\n'; tab '\t'. Otherwise it returns 0.

- isupper

cctype: Returns true (a nonzero number) if the argument is an uppercase letter. Otherwise, it returns 0.

- setw(number_of_spaces) example: cout << setw(5) << value;

cout offers a way of specifying the minimum number of spaces to use for each number. A stream manipulator, _____, can be used to establish print fields of a specified width.

char myword [] = { 'H', 'e', 'l', 'l', 'l', '\0' }; or char myword [] = "Hello";

during initialization of a char array we can initialize the array of char elements called "myword" with a null-terminated sequence of characters by either one of these two methods: ______________________

\a

escape code for alert (beep)

\\

escape code for backslash (\)

\b

escape code for backspace

\r

escape code for carriage return

\"

escape code for double quote (")

\f

escape code for form feed (page feed)

\n

escape code for newline

\?

escape code for question mark (?)

\'

escape code for single quote

\t

escape code for tab

\v

escape code for vertical tab

-EXIT_FAILURE -EXIT_SUCCESS example: exit(EXIT_FAILURE);

exit function: If you are unsure which code to use with the exit function, there are two named constants, ________ and ___________, defined in cstdlib for you to use.

- initialization - update - test - test

for loop: Connecting multiple statements with commas works well in the __________ and ________ expressions, but do not try to connect multiple expressions this way in the ______ expression. If you wish to combine multiple expressions in the _____ expression, you must use the && or || operators.

- data type - identifier

functions: type name ( parameter1, parameter2, . . .) { statements } -type is the ______ specifier of the data returned by the function. -name is the _____ by which it will be possible to call the function. -parameters (as many as needed): each parameter consists of a data type specifier followed by an identifier, like any regular variable declaratio and which acts within the function as a regular local variable. They allow to pass arguments to the function when it is called. -statements is the function's body.

short int long int -example: these two lines are equal short year; short int year;

short and long can be used alone as type specifiers. In this case, they refer to their respective integer fundamental types: short is equivalent to ________ and long is equivalent to ________.

signed int unsigned int -example: these two lines are equal unsigned NextYear; unsigned int NextYear;

signed and unsigned may be used as standalone type specifiers, meaning the same as _______ and _________ respectively.

- restricted - slow

switch versus if statements: switch: _________, fast if: versatile, ______

percentage sign ( % ). example: a = 11 % 3; the variable will contain the value 2, since 2 is the remainder from dividing 11 between 3.

the modulo operator sign is the _______. Modulo is the operation that gives the remainder of a division of two values.

- exception - exception

the nothrow method of dealing with failed memory allocations requires more work than the ________ method, since the value returned has to be checked after each and every memory allocation. The nothrow method can become tedious for larger projects, where the _________ method is generally preferred.

- pseudo - same values (you can use the time function as a seed for a more random number)

the rand() function is actually a _______ random number. If you run the rand() function twice with the same starting value you will get the ______

explicit type conversion (this may be needed before doing a calculation on a variable)

to convert on variable to a different type just type the new target type in parenthesis before the variable to be changed. This is called an ______________.

- don't actually

toupper and tolower ____________ cause the character argument to change, they simply return the upper- or lowercase equivalent of the argument.

synonyms

typedef does not create defferent types. It only creates _________ of existing types.

break

using ______ you can leave a loop even if the condition for its end is not fulfilled.

- indirection example: cin >> *input; // <--- the asterisk

using cin >> commands with pointers: It's critical that the _________ operator be used with the cin command or the value entered by the user will be stored as if the value were an address. If this happens, the pointer will no longer point to the intended variable. Subsequent use of the pointer will result in erroneous, if not disastrous, results.

strings

variables that can store non-numerical values that are longer than one single character are known as ______.

- 25 - A

vector<char> letters(25, 'A'); - Defines letters as a vector of ____ characters. Each element is initialized with ______.

parameter list example: void printmessage (void) { cout << "I'm a function!"; } or - simply leave the parameter list blank, still need parentheses.

void can also be used in the function's __________ to explicitly specify that we want the function to take no actual parameters when it is called.

off-by-one error

A common type of mistake is the __________. This is an easy mistake to make because array subscripts start at 0 rather than 1.

- strcmp example: if (strcmp(string1, string2))

#include <cstring> : ____________ - Accetps two C-strings or pointers to two C-strings arguments. If string1 and string2 are the same, this function returns 0. If string2 is alphabetically greater than string1, it returns a negative number. If string2 is alphabetically less than string1, it returns a positive number.

- strncpy example: strncpy(string1, string2, n);

#include <cstring> : ____________ - Accetps two C-strings or pointers to two C-strings, and an integer argument. The third argument, an integer, indicates the maxiumum number of characters to copy from the second C-string to the first C-string. If n is less than the length of string2, the null terminator is not automatically appended to string 1. If n is greater than the length of string2, string1 is padded with '\0' characters.

- pointer variable - pointer

A _____________ is a special variable that holds a memory address. Just as int variables are designed to hold integers, and double variables are designed to hold floating-point numbers, _________ variables are designed to hold memory addresses.

- promote - demote - type conversion ( this is done using the expression: static_cast<datatype>(value) )

A type case expression lets you manually _______ or _______ a value. Or it allows you to perform manual __________.

-global -local -global -local

A variable can be either ______ or _______ scope. A _______ variable is a variable declared in the main body of source code, outside all functions, while a ______ variable is one declared within the body of a function or a block.

prototype example type name (argument_type1, argument_type2, ...);

An alternative to declaring functions before the main function is to declare a ________ of the function before it is used, instead of the entire definition. This declaration is shorter than the entire definition, but significant enough for the compiler to determine its return type and the types of its parameters.

- pointer ( The parentheses are critical when adding values to pointers. The * operator has precedence over the + operator, so the expression *number + 1 is not equivalent to *(number +1).

An array can be retrieved by using its subscript or by adding its subscript to a ________ to the array. If the expression *numbers, which is the same as *(numbers + 0), retrieves the first element in the array, then *(numbers + 1) retrieves the second element.

pointer constants

Array names are ____________. You can't make them point to anything but the array they represent.

- pointers - pointers

Array names can be used as constant _________, and _________ can be used as array names.

- overflowed

Being true to C++'s nature, strcpy performs no bounds checking. The array specified by the first argument will be _______ if it isn't large enough to hold the string specified by the second argument.

signed

By default, if we do not specify either signed or unsigned most compliler settings will assume the type to be ______.

- value - reference

By default, vectors are passed by _________, whereas arrays are only passed by _________.

- does not

C++ _______ perform array bounds checking. This means you can write programs with subscripts that go beyond the boundaries of a particular array.

- parentheses () - asterisk ( * )

C++ allows operations with pointers to functions. The typical use of this is for passing a function as an argument to another function, since these cannot be passed dereferenced. In order to declare a pointer to a function we have to declare it like the prototype of the function except that the name of the function is enclosed between _________ and an _________ is inserted before the name.

- asterisk (*) - each level {char a; char * b; char ** c; }

C++ allows the use of pointers that point to pointers, that these, in its turn, point to data (or even to other pointers). In order to do that, we only need to add and ______ for __________ of reference in their declarations.

initialization list

C++ allows you to initialize an array's elements when you create an array. The series of values inside the braces and separated with commas is called an ________________.

reference

C++ provides a special type of variable called a ________ variable that, when used as a function parameter, allows access to the original argument.

escape codes

Character and string literals have certain peculiarities, like the ______. These are special characters that are difficult or impossible to express otherwise in the source code of a program, like newline (\n) or tab (\t). All of them are preceded by a backslash (\).

-backslash -backslash examples: \23 \x4A

Characters can also be expressed by its ASCII code by writing a ______ character followed by the ASCII code expressed as an octal or hexadecimal number. For an octal the digits immediately follow the _______, and for a hexadecimal an x character must be written before the digits themselves.

long double -data types

Command for a long double precision floating point number. Size is 8 bytes. Range +/- 1.7e +/- 308 (~15 digits)

price = price * (units + 1)

Compound Assignments: The expression ( price *= units + 1; ) is equal to _______________.

float

Data Types: Command for a floating point number. size is 4 bytes. Range: +/- 3.4e +/- 38 (~ 7 digits)

long int

Data Types: Command for a long integer. 4 bytes in size. Range: signed = -2,147,483,648 to 2,147,483,647; unsigned = 0 to 4,294,967,295.

short int

Data Types: Command for a short integer. 2 bytes in size. Range: signed = -32768 to 32767; unsigned = 0 to 65535.

wchar_t

Data Types: Command for a wide character. 2 or 4 bytes in size. Range: 1 wide character.

int -data types

Data Types: Command for an integer. 4 bytes in size. Range: signed = -2,147,483,648 to 2,147,483,647; unsigned = 0 to 4,294,967,295.

null character ('\0')

Double quoted strings (") are literal constants whose type is in fact a null-terminated array of characters. So string literals enclosed between double quotes always have a __________ automatically appended at the end.

value example: int * number; char * character; float * greatnumber;

Due to the ability of a pointer to directly refer to the _______ that it points to, it becomes necessary to specify in its declaration which data type a pointer is going to point to. It is not the same thing to point to a char as to point to an int or a float.

after

Global variables can be referred from anywhere in the code, even inside functions, whenever it is _____ its declaration.

for B=3: A=++B; (A contains 4, B contains 4) A=B++; (A contains 3, B contains 4)

If B=3: for A=++B; what are the values of A and B? for A=B++; what are the values of A and B

- [ ]

If a pointer points to a dynamically allocated array, the _____ symbol must be placed between delete and the pointer.

True; the library function "pow" must be used.

T or F. Exponents are not allowed in C++.

Void -This is a special specifier that indicates absence of type.

Imagine that we want to make a function just to show a message on the screen. We do not need it to return any value. In this case we should use the ____ type specifier for the function.

- parameter types - number - parameters - parameters

In C++ two different functions can have the same name if their ________ or ______ are different. That means that you can give the same name to more than one function if they have either a different number of __________ or different types in their _________.

- consecutive - null character

In C++, a C-string is a sequence of characters stored in ___________ memory locations, terminated by a ____________.

- signature - function signature

In C++, each function has a _________. The ______________ is the name of the function and the data types of the function's parameters in the proper order.

base_type [] [depth] [depth] for example: void procedure (int myarray[] [3] [4])

In a function declaration it is also possible to include multidimensional arrays. The format for a tridimensional array parameter is: _____________

- 0 (zero character) - 0x (zero, x) example: all are equal 75 // decimal 0113 // octal 0x4b // hexadecimal

In addition to decimal numbers, C++ allows the use of octal numbers (base 8) and hexadecimal numbers (base 16) as literal constants. If we want to express an octal number we have to precede it with a ____. And in order to express a hexadecimal number we have to precede it with the characters _______.

name[index]

In any point of a program in which an array is visible, we can access the value of any of its elements individually as if it was a normal variable, thus being able to both read and modify its value. The format is as simple as: ________________

- element type example: void procedure (int arg[])

In order to accept arrays as parameters the only thing that we have to do when declaring the function is to specify in its parameters the __________ of the array, and identifier and a pair of void brackets [ ].

- new - data type - brackets [ ]

In order to request dynamic memory we use the operator ______. Which is followed by a _________ specifier and if a sequence of more than one element is required then the number of these elements is declared within ________

is not

It _____ necessary to list the name of the parameter variable in the function prototype.

initialization list

It's possible to define an array without specifying its size, as long as you provide an ____________.

fstream

Just as cin and cout require the iostream file to be included in the program, C++ file access requires another header file. The file _______ contains all the declarations necessary for file operations.

True example: vector<double> values2(values1); // values1 is a vector

T or F. You may initialize a vector with the values in another vector.

True example: int myValue, *pint = &myValue; ( This is only legal if you define the variable first. You can not point to a variable that has not been created. )

T or F? Pointers may be defined in the same statement as other variables of the same type.

equal to example: ( 7 == 5 ) // evaluates to false

Relational and equality operators: == means __________.

- \0 ("slash zero") ( considered a single character )

Remember that _________ is the escape sequence representing the null terminator. It stands for the ASCII code 0.

right-hand -This is mostly important when the right-hand expression has side effects, such as altering values.

Short-Circuit: for the || logical operator If the left-hand side expression is true, the combined result is a true (________ side expression is not evaluated).

- null character - '\0' ( backslash, zero )

Since an array of characters can store shorter sequences than its total length, a special character is used to signal the end of the valid sequence: the ___________, whose literal constant can be written as ______.

delete example: delete pointer; delete [] pointer

Since the necessity of dynamic memory is usually limited to specific moments within a program, once it is no longer needed it should be freed so that the memory becomes available again for other requests of dynamic memory. This is the purpose of the operator _______.

! example: !(5 == 5) // evaluates to false because the expression at its right (5 == 5) is true.

The Operator ___ is the C++ operator to perform the Boolean operation NOT, it has only one operand, located at its right, and the only thing that it does is to inverse the value of it, producing false if its operand is true and true if its operand is false. Basically, it returns the opposite Boolean value of evaluating its operand.

- for - for for (initialization; condition; increase) statement;

The ____ loops function is to repeat statement while "condition" remains true, like the while loop. But in addition, the _____ loop provides specific locations to contain an initialization statement and an increase statementtttt. So this loop is specially designed to perform a repetitive action with a counter which is initialized and increased on each iteration.

the for loop

The _____ loop is ideal in situations where the exact number of iterations is known.

return 0;

The _____ return statement causes the main function to finish. _____ may be followed by a _____ code with a value of zero. A ______ code of 0 for the main function is generally interpreted as the program worked as expected without any errors during its execution. This is the most usual way to end a C++ console program.

- pow example: area = pow(4.0, 2.0); equivalent to area = 4^2

The ______ function is a library function used to raise one number by a power of a second number.

- if Its form is: if (condition) statement if more than one statement is needed then enclose them in braces { }.

The ______ keyword is used to execute a statement or block only if a condition is fulfilled.

The while loop

The ______ loop is ideal in situations where you do not want the loop to iterate if the condition is false from the beginning.

sizeof() example: a = sizeof (char); This will assign the value of 1 to a because char is a one-byte long type.

The ______ operator accepts one parameter, which can be either a type or a variable itself and returns the size in bytes of that type or object.

- inline - inline example: inline type name (arguments ...) { instructions .... }

The ______ specifier indicates the compiler that _____ substitution is preferred to the usual function call mechanism for a specific function. This does not change the behavior of the function itself, but is used to suggest to the compiler that the code generated by the function body is inserted at each point the function is called, instead of being inserted only once and perform a regular call to it, which generally involves some additional overhead in running time.

continue example: if (count==5) continue;

The ______ statement causes the program to skip the rest of the loop in the current iteration as if the end of the statement block had been reached, causing it to jump to the start of the following iteration.

switch - switch (x) { case 1: break; case 2: break; default: cout << "value of x unknown"; }

The ______ statement is used to check several possible constant values for an expression; similar to the else if instructions.

exit()

The _______ function unconditionally shuts down your program. Because it bypasses a program's normal logical flow, you should use it with caution.

arrow operator ( -> ) example: pmovie->title (which would be equivalent to (*pmovie).title

The _______ operator is a dereference operator that is used exclusively with pointers to objects with members. This operator serves to access a member of an object to which we have a reference.

- bubble - bubble

The _______ sort is an easy way to arrange data in ascending or descending order. The ______ sort starts by comparing the first two elements in the array and exchanging them if necessary. This process goes through all elements and then starts back at the beginning if necessary.

- continue - continue ( as opposed to a break statement that stops the loop completely. the continue command only stops a single iteration )

The _______ statement causes the current iteration of a loop to end immediately. When ________ is encountered, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.

- reference - reference - ampersand sign (&) example: ted = &andy;

The address that locates a variable within memory is what we call a ________ to that variable. This ________ to a variable can be obtained by preceding the identifier of a variable with an ___________, known as a reference operator, and which can be literally translated as "address of".

^

The bitwise operator ____ has an asm equivalent of XOR. Description: Bitwise Exclusive OR

- selection

The bubble sort is inefficient for large arrays because items only move by one element at a time. The _______ sort, however, usually performs fewer exchanges because it moves items immediately to their final position in the array. It works like this: The smallest value in the array is located and moved to element 0. Then the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order.

initialization and increase example: for (;n<10;)

When using the "for loop" the ________ and _______ fields are optional.

double examples: 3.14159l // long double 6.02e23f // float -Any of the letters that can be part of a floating-point numerical constant (e,f,l) can be written using either lower or uppercase letters without any difference in their meanings.

The default type for floating point literals is ______. If you want to express a float or a long double numerical literal, you can use the f or l suffixes respectively.

- integer literal - constant

The expression following the word case must be an __________ or a ________. It cannot be a variable, and it cannot be an expression such as x < 22 or n == 50.

- constant - during the execution of the program ( runtime )

The most important difference between an array and assigning dynamic memory is that the size of an array has to be a _______ value, which limits its size to what we decide at the moment of designing the program, before its execution. Dynamic memory allocation allows us to assign memory during the ________________ using any variable or constant value as its size.

- associative - Associative

There are two types of containers in the STL (Standard Template Library): sequence containers and __________ containers. A sequence container organizes data in a sequential fashion, similar to an array. ___________ containers organize data with keys, which allow rapid, random access to elements stored in the container.

- reverse() example: vectorName.reverse(); ( This statement reverses the order of the element in vectorName. )

Vector Member Functions: _________ - Reverses the order of the elements in the vector. ( The last element becomes the first element, and the first element becomes the last element.)

- at(element) example: x = vectorName.at(5) ; ( This statement assigns the value of the fifth element to vectorName to x. )

Vector Member Functions: __________ - Returns the value of the element located at element in the vector.

- capacity() example: x = vectorName.capacity(); ( this statement assigns the capacity of vectorName to x. )

Vector Member Functions: ____________ - Returns the maximum number of elements that may be stored in the vector without additional memory being allocated. (This is not the same value as returned by the size member function).

- left blank - ignored example: int divide (int a, int b=2)

When declaring a function we can specify a default value for each of the last parameters. This value will be used if the corresponding argument is ________ when calling to the function. To do that, we simply have to use the assignment operator and a value for the arguments in the function declaration. If a value for that parameter is not passed when the function is called, the default value is used, but if a value is specified this default value is ________ and the passed value is used instead.

exit

When the ______ function is called, it causes the program to stop, regardless of which function contains the call.

- dereferences - dereferenced

When the indirection operator is placed in front of a pointer variable name, it __________ the pointer. When you are working with a ______________ pointer, you are actually working with the value the pointer is pointing to.

- size member example: for (int index = 0; index < units.size(); indexx++) sales.push_back(units[index] * prices[index]);

When using a vector argument in a function it's not needed to pass the current size of the vector as one would with an array argument. This is not necessary because vector have the ____________ function.

Floating Point Numbers examples: 3.14159 // 3.141159 6.02e23 // 6.02 x 10^23 1.6e-19 // 1.6 x 10^-19 3.0 // 3.0

_______: They express numbers with decimals and/or exponents. They can include either a decimal point, an e character (that expresses "by ten at the Xth height", where X is an integer value that follows the e character), or both.

- Type casting - parentheses () Another way to do the same thing is to use functional notation: preceding the expression to be converted by the type and enclosing the expression between parentheses.

________ operators allow you to convert a datum of a given type to another. There are several ways to do this in C++. The simplest one is to precede the expression to be converted by the new type enclosed between __________.

- references - pointers - references

________ variables are much easier to work with than _______. _________ variables hide all the "mechanics" of dereferencing and indirection.

typedef

_________ can be useful to define an alias for a type that is frequently used within a program. It is also useful to define types when it is possible that we will need to change the type in later versions of our program, or if a type you want to use has a name that is too long or confusing.

- sizeof - constant

_________ is an operator integrated in the c++ language that returns the size in bytes of its parameter. For non-dynamic data types this value is a _________.

recursivity

__________ is the property that functions have to be called by themselves. It is useful for many tasks, like sorting or calculate the factorial of numbers.

- isalpha

cctype: ________ Returns true (a nonzero number) if the argument is a letter of the alphabet. Returns 0 if the argument is not a letter.


Set pelajaran terkait

Area of a Circle and a Sector Assignment

View Set

Parts of the Egg and Their Functions

View Set

Ch.5- Write the chemical formula

View Set

Ch. 14: Bonds and Long-Term Notes

View Set

Vertebral Column and Thoracic Cage

View Set