Module 4 : Heading Towards C Plus Plus - AlproITS/StrukturData GitHub Wiki

Heading Towards C++

After 1 whole year of C, now we're going to learn about C++

C++

C++ is a programming language developed from C.

What is new in C++?

  • Library <iostream>
    This library provide input output functions.

    • cin - standard input
    • cout - standard output

    Trivia: what is the difference between cin with scanf and cout with printf?
    Hint: Take a glance at the implementation.

  • namespace
    In C, we usually use the prefix on identifier to avoid name conflicts. The namespace can be likened to a container that is used to group functions (or other data) so that they can be distinguished.

  • class
    Familiar with struct ? class is also a User Defined Data Type. The only difference is the default of the access modifier. In struct the default* is public, while in class the default is private (will be studied further in the Object Oriented Programming course, don't get confused first).

  • template To create a function or class that can adapt and work with different data types, use template.

  • 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.

⚠️ **GitHub.com Fallback** ⚠️