Learning C++ :It is not hard

Token : "Useful References", "Think Simple", and "Nothing is complicated if you have set your mind to do it".

Using C++ :

  • Source File: C++ programming begins with a source file that contain a list of instructions that computer will execute. We write these instructions within a defined zone, and there would be some rules you must abide.

  • You need an Editor: In the above illustration, I used a text editor and saved in a folder where an application (a compiler more precisely) can apprehend this instruction and converts into an executable. An executable files usually converts all the statements into machine languages, (visibly it will be ones and zeros), and you can call trigger this executable to display the results.

  • You preach the same what you practice: Below, I demonstrated that I used an text Editor like Text Pad 4.0, opened an existing document edited it and used window's command line application to compile and display the results.

  • You pick a compiler you like: There are many C/C++ programming compilers available, and I would try to touch base with few of these compilers later down the road. In the current document, you would notice that I used MinGW compiler, and which also served as the applications like Eclipse and NetBeans.


Theme of C++ : What you are getting into.

  • C/C++ is the mother of all programming languages, and consists of three different themes. If you know C/C++, it would be much easier to understand other programming languages.
    • C is  a procedural language:  It is a procedural language, here int main() is a procedure or a function , converting your instruction to machine language, and creates an executable, file which can be invoked to perform a task.

      With C language, you will save file like  "Only_c1.c" . In contrast with C++ language  you will use  a different extension, "helloworld.cpp". The "<iostream>" and "namespace" are the modules provided by C++ libraries.

      The syntax "#include <  >"  or "#define File1", would prevent these modules loaded more than once. Since these modules predeeds "main()" function, these are known as "header files".

    • Each C/C++ program must have one "main()" function, which serves as an entry point of a C/C++ compiler.

    • C++ is Object Oriented: It is object oriented, and which enhanced with the uses of classes, templates and structs. In C/C++ either you define functions before this main() function, or create a prototype (signature a of member function or object) before "main()" function. As you notice that line "void getcity(struct City city)" , introduces a function which will be defined later, this type of preceding structure is referred as a "prototype".

    • Integrated Development Environment (IDE): There are many easy to sue applications Visual Studio, Eclipse or NetBeans  are available, and most of these would make your coding easier than the conventional text editors. The illustration below, shows that  how Eclipse IDE can assist you by providing prompts to use the objects created with templates of C++ language!

Always Explore what you have and not what you don't have>