C++ Cheat Sheet


  // Single-line comment
  // This is a single-line comment in C++. It starts with two slashes.
  
  /*
   * Multi-line comment
   * This type of comment spans multiple lines.
   * It starts with a slash and an asterisk and ends with an asterisk and a slash.
   */
  
  /**
   * Documentation comment
   * This is a documentation comment used to generate documentation with Doxygen or other tools.
   * It provides descriptions for classes, methods, and functions.
   * @param argc Number of arguments
   * @param argv Array of arguments
   */
  #include <iostream>
  
  int main(int argc, char* argv[]) {
      // This line prints a message to the console
      std::cout << "Hello, World!" << std::endl; // Inline comment
  
      return 0;
  }
  
© 2024 CheatsheetCoder, All Rights Reserved.