Skip to content

Instantly share code, notes, and snippets.

@Artin0123
Created February 24, 2025 15:40
Show Gist options
  • Save Artin0123/5ad264a4c37ab37c1faff20fc55a40c8 to your computer and use it in GitHub Desktop.
Save Artin0123/5ad264a4c37ab37c1faff20fc55a40c8 to your computer and use it in GitHub Desktop.

Revisions

  1. Artin0123 created this gist Feb 24, 2025.
    15 changes: 15 additions & 0 deletions cpp_version.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #include <iostream>
    int main() {
    if (__cplusplus == 202002L)
    std::cout << "C++20\n";
    else if (__cplusplus == 201703L)
    std::cout << "C++17\n";
    else if (__cplusplus == 201402L)
    std::cout << "C++14\n";
    else if (__cplusplus == 201103L)
    std::cout << "C++11\n";
    else if (__cplusplus == 199711L)
    std::cout << "C++98\n";
    else
    std::cout << "pre-standard C++\n";
    }