Vous êtes sur la page 1sur 4

1. What is meant by the term prompt?

Prompt is a sentence that prompts user to input.

2. Which operator do you use to read into a variable?

input operator ">>"

3. cout << "Please enter an integer: ";

int number = 0;

cin >> number;

4. \n is called newline. It is to enter a new paragraph.

5.Whitespace. Space, Enter, and tab characters.

6.Whitespace.

7. cout << "hello, " << first_name << "!\n"

8. An object is a region of memory with a type that specifies what kind of


information can be placed in it.

9. Literal represents the values of various types.

10. There are boolean literals, string literals, integer literal, floating-point
literals, character literals.

11. A variable is a named object.

12. char: 8 bits, int: 4 bytes, double : 8 bytes.

13. ints: 4 bytes, number.

strings: depends on the characters.

14. = is an assignment. == is an equal sign.

15. A definition is a statement that gives name to a variable.

16. Initialization is a definition. An assignment is to assign values to


variables that have known types.

17. String concatenation is connect two string variables. Use + to connect


two or more variables.

18.this_little_pig: ok

this_1_is fine: contains space

2_for_1_space: not ok, starts with a number.

latest thing: contains space

the_$12_method: contains unknown characters

_this_is_ok: not ok, starts with an underscore.

MineMineMine: ok

number: ok

correct?: contains signs.

19.string,double,char,bool,int

20. Short, underscore for space, avoid implementation _, avoid names in


standard library, careful of i,1,I,o,0,O,...

21. Type-safe is using objects according to the rules of their type. Type-
safe is using objects according to the rules of their type.

A type defines a set of possible values and a set of operations (for an


object).

• An object is some memory that holds a value of a given type.


• A value is a set of bits in memory interpreted according to a type.
• A variable is a named object.
• A declaration is a statement that gives a name to an object.
• A definition is a declaration that sets aside memory for an object.

22. Conversion from double to int can cause a value to turn into a value of
other type that does not equal to the original value.

23. Conversion from the smaller to a larger variable is safe. Conversion


from larger to smaller variable is unsafe.

Terms:

Assignment: Giving variable a new value.

cin: character input stream.

concateration: connects the two strings together.

Conversion: Change of type

Declaration: a statement that gives a name to an object.

Decrement: Decreasing in value

Definition: A declaration that sets aside the memory for an object.

increment: increasing in value

initialization: Giving a variable its initial value.

name: something we call an object to access it.

Narrowing conversion : unsafe conversion

Object: a region of memory that a type specifies the kind of information


that can be placed in it.

Operation: Read the operation into a string is called Operation.

Operator: symbols to communicate with the machine to perform


operation.

type: specify kind of information be placed in object.

type-safety: using objects according to the rules of their types.

Value: a set of bits in memory interpreted according to a type.


Variable: a named object.

Vous aimerez peut-être aussi