C++ version
Date: 2022-12-05Last modified: 2024-11-02
Table of contents
#include <iostream>
int main()
{
switch( __cplusplus ) {
case 202002L:
std::cout << "C++20\n";
break;
case 201703L:
std::cout << "C++17\n";
break;
case 201402L:
std::cout << "C++14\n";
break;
case 201103L:
std::cout << "C++11\n";
break;
case 199711L:
std::cout << "C++98\n";
break;
default:
std::cout << "pre-standard C++: " << __cplusplus << "\n";
}
return 0;
}
Possible output
C++20