fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4. long standard = __cplusplus;
  5.  
  6. if (standard == 199711L) {
  7. std::cout << "Standard: C++98" << std::endl;
  8. } else if (standard == 201103L) {
  9. std::cout << "Standard: C++11" << std::endl;
  10. } else if (standard == 201402L) {
  11. std::cout << "Standard: C++14" << std::endl;
  12. } else if (standard == 201703L) {
  13. std::cout << "Standard: C++17" << std::endl;
  14. } else if (standard == 202002L) {
  15. std::cout << "Standard: C++20" << std::endl;
  16. } else {
  17. std::cout << "Standard: Unknown or newer/older preview (" << standard << ")" << std::endl;
  18. }
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Standard: C++14