Tutorials

C++ Tutorial

All Tutorials Learning Tools Login

C++ Tutorial · Chapter 3 of 13

C++ Syntax

Headers, namespace, and main().

Many beginner programs include <iostream> and use namespace std.

Statements end with semicolons. Blocks use curly braces.

Syntax sample Try it Yourself »
#include <iostream>
using namespace std;

int main() {
    cout << "Syntax check" << endl;
    return 0;
}

Classroom Tips

  • endl ends the line and flushes output.
  • Keep one clear statement per line while learning.