codegurukool.com · Free coding tutorials & online compiler

Home › C++ Tutorial › C++ syntax and comments

C++ syntax and comments

Parts of a program.

#include loads a header, main() starts the program, statements end with ;. Comment with // or /* */.

Example code

#include <iostream>
using namespace std;
int main() {
  // single line
  /* multi
     line */
  cout << "Syntax" << endl;
  return 0;
}

Run this code in the online editor

← C++ installationC++ output →