Module 4 : Heading Towards C Plus Plus - AlproITS/StrukturData GitHub Wiki
After 1 whole year of C, now we're going to learn about C++
C++ is a programming language developed from C.
-
Library
<iostream>
This library provide input output functions.-
cin
- standard input -
cout
- standard output
Trivia: what is the difference between
cin
withscanf
andcout
withprintf
?
Hint: Take a glance at the implementation. -
-
namespace
In C, we usually use the prefix on identifier to avoid name conflicts. Thenamespace
can be likened to a container that is used to group functions (or other data) so that they can be distinguished. -
class
Familiar withstruct
?class
is also a User Defined Data Type. The only difference is the default of the access modifier. In struct the default* ispublic
, while inclass
the default isprivate
(will be studied further in the Object Oriented Programming course, don't get confused first). -
template
To create a function orclass
that can adapt and work with different data types, usetemplate
. -
and many more...
Note: all libraries that apply in C also apply in C ++, but not the other way around.
What does
using namespace std;
mean in the implementation example? ** standard library ** in C ++ uses ** prefix **std::
so that it can be used. So, to avoid writing the prefix over and over again, add these lines to the program.