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.
查詢cpp版本
#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";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment