There are multiple compilers and text editors you
can use to run C++ programming. These may differ
from system to system.
If you want a quick start, you can also run C++
program online.
$ sudo apt-get update
$ sudo apt-get install build-essential manpages-dev
$ gcc –version ()
g++ program-source-code.cpp -o name-of-your-choice
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!";
return 0;
}
includes the header file into the application so
that you are able to use the operations
included in them.
Also, you can create your own header files and
include them in your program using the
#include.
you are “using” the “namespace” “std” in your
file.
We use the namespace std to make it easier to
reference operations included in that
namespace.
If we hadn’t used the namespace, we’d have
written std::cout instead of cout.
cout is actually std::cout.
The semicolon is a terminal. It terminates a
statement.
When missed or incorrectly used, it will cause a
lot of issues.
it is the main function of the program
The code inside { } is called the body and is
executed first when you run your C++ program.
It is one code that is mandatory in a C++
program.
The cout is an object of standard output
stream.
it outputs/prints the data after <<
This statement returns 0 ‘zero’.
It isn’t mandatory to return anything from the
main() function but is rather a convention.
Some of them are:
StackOverflow - Most Popular programming Q&A
site on the web
Codechef - Practice questions, challenges and a
large community of programmers
CodeProject - For those who code, with in-depth
articles and huge community of coders
The break; statement terminates a loop (for, while and do..while loop) and a
switch statement immediately when it appears.
It is sometimes necessary to skip a certain test condition within a loop.
The goto statement can be replaced in most
of C++ program with the use of
break and continue statements.
پایان بخش اول •