Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
27 Cards in this Set
- Front
- Back
2.2: concept: Use the cout object to display information on the computer's screen |
Use the cout object to display information on the computer's screen. |
|
What is console output? |
plain text |
|
What is a console? |
The terminal, which consisted of a simple screen and keyboard, was known as the console. |
|
In C++ you use the cout object to produce what type of output? |
console output. |
|
You can think of cout as meaning... |
console output. |
|
What is a stream object do? |
It works with streams of data. cout is one such example. You send a stream of characters to cout. |
|
You use what symbol to send a string to cout? |
<< ...the stream insertion operator. |
|
What happens to everything to the right of the stream-insertion operator? |
it is sent to cout and then displayed on the screen. |
|
How do you write a stream insertion operator? |
as two less-than signs with no space between them. i.e. << |
|
cout displays messages exactly as they are sent. true or false? |
True. If spaces are to be displayed, they must appear in the strings. |
|
What are the two ways to instruct cout to start a new line? |
1. with a stream manipulator called endl; 2. with a newline escape sequence : \n |
|
What does an escape sequence start with? And what does it allow you to do?? |
it starts with a backslash character ( \ ) and is followed by one or more control characters. It allows you to control the way output is displayed by embedding commands within the string itself. |
|
Why do many programmers prefer using the newline escape sequence rather than the stream manipulator? |
They prefer the newline escape sequence rather than the stream manipulator because it requires less typing. |
|
What is the difference in syntax between the newline escape sequence and the stream manipulator? |
The newline escape sequence ( \n ) is written inside quotes, while the stream manipulator ( endl; ) is written outside of quotes. You must know where to place them in your code as well. |
|
When using escape sequences, put a space between the backlash and the control character. true or false? |
False: an escape sequence is stored in memory as a single character. Thus, no space should be put between the backlash and the control character. |
|
2.3: concept: The #include directive causes the contents of another file to be inserted into a program. |
The #include directive causes the contents of another file to be inserted into the program. |
|
How would you implement the input-output stream library? |
#include (io stands for input output) |
|
What is the preprocessor's job? |
to set programs up in a way that makes life easier for the programmer. |
|
Is a library? |
Yes. |
|
2.4: concept: Variables represent storage locations in the computer's memory. |
Literals are constant values that are assigned to variables. |
|
What is variable definition? |
a variable definition defines the type of variable that will be stored and used. |
|
What is the variable definitions purpose? |
It tells the compiler the variable's name and the type of data it will hold. |
|
What is an assignment? |
An assignment ends a variable definition with a semicolon. (Ex: number = 5;) |
|
What is a literal? |
A piece of data that is written directly into a program's code. One of the most common uses of literals is to assign a value to a variable. |
|
What type of literal is 20 and 0? |
Integer Literal |
|
What type of literal are "Today we sold " and "bushels of apples. \n" ? |
String Literal |
|
Is "189" a string literal or a integer literal? Why? |
String Literal, because the number 189 has double quotation marks around it. |