output Flashcards

1
Q

1) Syntax

A

cout &laquo_space;Expression; OR
cout &laquo_space;Expression &laquo_space;Expression … &laquo_space;Expression;
2) Each Expression MUST be preceeded by a “

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

3) Expression Types:

A
5 types
Identifier name
Literal string or char
 Output manipulator
Mathematical Expressions
Value-returning functions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Type #1 - Identifier name

A

(outputs the value of the indentifier)
Example:
int num1 = 25;
cout &laquo_space;num1;

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

Type #2 - Literal string or char

A
(outputs the value between the quotes)
						Example:
						cout << '%';
						cout << "B a L l";
						cout << "\n";
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Type #3 - Output manipulator

A
a. endl (end-line) - it causes a carriage return (or use "\n")
						Example:
						cout << endl;
					 b. setprecision
					 c. fixed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Type #4 - Mathematical Expressions

A

Example:
cout &laquo_space;5 + 8;
cout &laquo_space;num1/10;

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

Type #5 - Value-returning functions

A

Example:
cout &laquo_space;cos(10.9);
cout &laquo_space;sqrt(32.4);

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

In order to modify the output you see on the screen,

A

you MUST change either the type 1, 2, 3, 4, or 5.

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

Output the following. Make sure the cursor is on
the next line after the output.
1) Good evening class!

A

//1
cout &laquo_space;“Good evening class!”;
cout &laquo_space;endl;
cout &laquo_space;endl;

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

Output the following. Make sure the cursor is on
the next line after the output.
2) Your grade was a:

A
//2
   float grade = 100;
   cout << "Your grade was a: ";
   cout << grade;
   cout << endl;
   cout << endl;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Output the following. Make sure the cursor is on
the next line after the output.
3) + =

A
//3
   int n1 = 0;
   int n2 = 0;
   int sum = 0;
   //assign values   
   n1 = 45;
   n2 = 55;
   sum = n1 + n2;

cout

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

Output the following. Make sure the cursor is on
the next line after the output.
4) = ( + ) /

A
//4
   float avg = 0;
   const int TOTAL_NUM_VALUES = 2;
   //assign values   
   avg = (n1 + n2) / TOTAL_NUM_VALUES;

cout &laquo_space;avg;
cout

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