Basics Flashcards
decimals in float
7
decimals in double
15
Strings are also sequences of characters but with
fixed length
char d[6] = “hello”;
string e = “developer”;
string f = “, “;
string g = “!”;
cout «_space;d+f+e+g «_space;endl;
Hello,developer!
list<int> numbers_list({1,10,100,1000});
can you print all together?</int>
No
list<int> numbers_list{1,10,100,1000};
numbers_list.push_front(0);
numbers_list.push_back(3000);
what is the resultant list?</int>
0,1,10,100,1000,3000
in c++, maps containt — and —- ?
keys, values
map<double, float> traj;
traj[1]=20;
traj[2]=100;
for (auto item : traj)
cout «_space;item.first «_space;”,” «_space;item.second «_space;“\n”;
1,20
2,100
what is a big advantage of using maps in c++?
It allows you to store two kinds of variable together
“cout «” is a function for printing only ….
characters (characters out-> cout)
what is the function for inputting characters
cin»_space;
what is namespace in C++
C++ has a particular feature called namespaces. They allow us to group named entities into a single scope. That way, they will only have a meaning inside that namespace. Also, we can repeat names of variables, but always inside different namespaces.
what are assignment operators in c++
=, +=, -=, *=, =/
what does “touch” do in linux?
it creates new file or update them (time stamp)
what is “./” in linux
run a file (eg excutable) that explicitly in the current directory. It helps with running faster and with no name confusion
what are three elements of defining a for loop?
for ( init; condition; increment ) {
block_statement;
}
which one is correct?
list (string) or list <string> or list [string]</string>
list <string></string>
how to go over list item using a for lop?
list <float> g;
for (auto i : g) {
cout <<i;</float>