// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
Hello World!
. This character is used to mark the end of the statement and in fact it must be included at the end of all expression statements in all C++ programs (one of the most common syntax errors is indeed to forget to include some semicolon after a statement).
int main ()
{
cout << "Hello World!";
return 0;
}
int main () { cout << "Hello World!"; return 0; }
at the end of each one, so the separation in different code lines does not matter at all for this purpose. We can write many statements per line or write a single statement that takes many code lines. The division of code in different lines serves only to make it more legible and schematic for the humans that may read it.
// my second program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! ";
cout << "I'm a C++ program";
return 0;
}
Hello World! I'm a C++ program
int main () { cout << " Hello World! "; cout << " I'm a C++ program "; return 0; }
int main ()
{
cout
<< "Hello World!";
cout
<< "I'm a C++ program";
return 0;
}
.
// line comment
/* block comment */
/* my second program in C++
with more comments */
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! "; // prints Hello
World!
cout << "I'm a C++ program"; // prints I'm a
C++ program
return 0;
}
Hello World! I'm a C++ program
a = 5;
b = 2;
a = a + 1;
result = a - b;
asm, auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, operator, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t, while
and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
Hello World!
. This character is used to mark the end of the statement and in fact it must be included at the end of all expression statements in all C++ programs (one of the most common syntax errors is indeed to forget to include some semicolon after a statement).
int main ()
{
cout << "Hello World!";
return 0;
}
int main () { cout << "Hello World!"; return 0; }
at the end of each one, so the separation in different code lines does not matter at all for this purpose. We can write many statements per line or write a single statement that takes many code lines. The division of code in different lines serves only to make it more legible and schematic for the humans that may read it.
// my second program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! ";
cout << "I'm a C++ program";
return 0;
}
Hello World! I'm a C++ program
int main () { cout << " Hello World! "; cout << " I'm a C++ program "; return 0; }
int main ()
{
cout
<< "Hello World!";
cout
<< "I'm a C++ program";
return 0;
}
.
// line comment
/* block comment */
/* my second program in C++
with more comments */
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! "; // prints Hello
World!
cout << "I'm a C++ program"; // prints I'm a
C++ program
return 0;
}
Hello World! I'm a C++ program
a = 5;
b = 2;
a = a + 1;
result = a - b;
asm, auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, operator, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t, while
and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
Hello World!
. This character is used to mark the end of the statement and in fact it must be included at the end of all expression statements in all C++ programs (one of the most common syntax errors is indeed to forget to include some semicolon after a statement).
int main ()
{
cout << "Hello World!";
return 0;
}
int main () { cout << "Hello World!"; return 0; }
at the end of each one, so the separation in different code lines does not matter at all for this purpose. We can write many statements per line or write a single statement that takes many code lines. The division of code in different lines serves only to make it more legible and schematic for the humans that may read it.
// my second program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! ";
cout << "I'm a C++ program";
return 0;
}
Hello World! I'm a C++ program
int main () { cout << " Hello World! "; cout << " I'm a C++ program "; return 0; }
int main ()
{
cout
<< "Hello World!";
cout
<< "I'm a C++ program";
return 0;
}
.
// line comment
/* block comment */
/* my second program in C++
with more comments */
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! "; // prints Hello
World!
cout << "I'm a C++ program"; // prints I'm a
C++ program
return 0;
}
Hello World! I'm a C++ program
a = 5;
b = 2;
a = a + 1;
result = a - b;
asm, auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, operator, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t, while
and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
Hello World!
. This character is used to mark the end of the statement and in fact it must be included at the end of all expression statements in all C++ programs (one of the most common syntax errors is indeed to forget to include some semicolon after a statement).
int main ()
{
cout << "Hello World!";
return 0;
}
int main () { cout << "Hello World!"; return 0; }
at the end of each one, so the separation in different code lines does not matter at all for this purpose. We can write many statements per line or write a single statement that takes many code lines. The division of code in different lines serves only to make it more legible and schematic for the humans that may read it.
// my second program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! ";
cout << "I'm a C++ program";
return 0;
}
Hello World! I'm a C++ program
int main () { cout << " Hello World! "; cout << " I'm a C++ program "; return 0; }
int main ()
{
cout
<< "Hello World!";
cout
<< "I'm a C++ program";
return 0;
}
.
// line comment
/* block comment */
/* my second program in C++
with more comments */
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! "; // prints Hello
World!
cout << "I'm a C++ program"; // prints I'm a
C++ program
return 0;
}
Hello World! I'm a C++ program
a = 5;
b = 2;
a = a + 1;
result = a - b;
asm, auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, operator, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t, while
and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
Copyright © 2026, NextGenUpdate.
All Rights Reserved.