Starting C++

C++ is very basic and old programming language. It gives programmer full control over computer and C++ program runs directly on computer processor hence it is fast. Developed from C language it is somewhat similar to it and somewhat better then C.

Libraries:

     Every programming language has many functions apart from user interaction and processor functions. For example handling various devices to get data from them and give them data to show to user. For ease to use these functions are provided in simplified form of standard libraries of code which is complex but we can use it by adding it to our program easily. For example to get user input we need to just insert a library called iostream (input output stream) in out program which has full functionality for input and output through keyboard and monitor. Similarly there is also a Math library which gives some functionality of complex mathematical topics like trigonometry (sin, cos, tan).
     To include libraries in C++ program we use import statements (these are called import statement not commands because these are not part of program but while translating program to computer code the code of these libraries will be copied in place of these statements) :
#include <library name> (name without any spaces)
Example:
#include <iostream>
#include <Math.h>
 It is very easy to search for information about any library on Google and Microsoft Site or Search for a library for some required functionality

Namespace:

      While programming, it is a good practice to arrange the code in some way that it is easy to work with. Some might think he doesn't need to but in beginning we write just sample codes to understand it's functionality thus we don't really need to do that but when it becomes to write a whole software, arranged code is of primary importance because it has 2 major uses:
  • Code arrangement
  • Step by step coding
Step by step coding is that when you have to implement many functions via code it's hard to do all at once. So here namespaces come in, we divide code by it's functionality and length and then give them to separate namespaces. For example if I'm making a game and it has some major functionality to be implemented by code. Let's have a look at it:
  • Graphics
  • User input
  • Game data
    • User information
    • Game files, sounds and maps etc.
Hence it is useful to divide code in above like parts and to seperate them in code C++ gives this functionality of namespaces. We make all the code separately and then join it in the end.

Main:

     In every program written in any programming language you will encounter a word 'main' which defines start of program. It is obvious any process starts from some point. In programming we define this start point as main. It is the beginning code that starts running when user opens a program. It is called main function (in C++) or main method (in java) but concept is the same that program will start running from this part.
     We declare main like this:
void main(void){
      commands are written here
}

Comments

  1. Best Free Spins Bonuses and Promotions in NJ December 2021
    Get 전주 출장안마 the best 순천 출장마사지 new casino bonuses, promos, and 광주 출장샵 betting bonuses in December 2021 - check out our list 경주 출장샵 of the top-rated New Jersey online 청주 출장안마 casinos to

    ReplyDelete

Post a Comment

Popular posts from this blog

C++ Console : Basic Graphic Techniques

C++ Console : Change Font Size

C++ Console : Color