C++ basics Flashcards

(18 cards)

1
Q

to be able to interact with the users keyboard inputs and be able to put text onto the screen what line of code is neede

A
#include 
using namespace std;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

output text to screen line

A

cout &laquo_space;“text”;

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

to output new line in text

A

\n

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

to output a tab character in text

A

\tab

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

to start a sing line comment

A

//

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

to start a multiple line comment

A

/*

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

floating point representation of a number vs int representation

A

5 vs 5.0

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

do #include lines end with semi colon

A

no

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

decalre a variable called celcius of type int

A

int celsius;

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

assign a declared variable called Celsius the number 5

A

celcius = 5;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
send three outputs to the screen in one line
these are:
int fahr
tab char
int celcius
A

cout &laquo_space;fahr &laquo_space;‘\t’ &laquo_space;celcius;

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

get input from the user. The input will be assigned to the already defined int i

A

cin&raquo_space; i;

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

get input from the user. There will be 2 inputs. They will be assigned to the already defined ints i and j

How can it separate this input

A

cin&raquo_space; i&raquo_space; j;

white space characters tells it when to move onto next int

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

line to include string class

A

include

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

line to include file reading

A

include

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

create a file stream object called myinput

and then connect the file called file_of_words to the file stream onject

A

ifstream myinput;

my input.open(“file_of_words”);

17
Q

in order to create a fucntion you must first

18
Q

to include an external function from another file in your program what line of code must be used

eg power function which is of type int and takes two ints of base and exponent

A

extern int power(int base, int exponent);

in the top of program