C++ basics Flashcards
(18 cards)
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
#include using namespace std;
output text to screen line
cout «_space;“text”;
to output new line in text
\n
to output a tab character in text
\tab
to start a sing line comment
//
to start a multiple line comment
/*
floating point representation of a number vs int representation
5 vs 5.0
do #include lines end with semi colon
no
decalre a variable called celcius of type int
int celsius;
assign a declared variable called Celsius the number 5
celcius = 5;
send three outputs to the screen in one line these are: int fahr tab char int celcius
cout «_space;fahr «_space;‘\t’ «_space;celcius;
get input from the user. The input will be assigned to the already defined int i
cin»_space; i;
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
cin»_space; i»_space; j;
white space characters tells it when to move onto next int
line to include string class
include
line to include file reading
include
create a file stream object called myinput
and then connect the file called file_of_words to the file stream onject
ifstream myinput;
my input.open(“file_of_words”);
in order to create a fucntion you must first
define it
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
extern int power(int base, int exponent);
in the top of program