1. #include <iostream>
    2. #include <sstream>
    3. using namespace std;
    4. std::string ver_srting(int a, int b, int c) {
    5. std::ostringstream ss;
    6. ss << a << '.' << b << '.' << c;
    7. return ss.str();
    8. }
    9. int main() {
    10. std::string true_cxx =
    11. #ifdef __clang__
    12. "clang++";
    13. #else
    14. "g++";
    15. #endif
    16. std::string true_cxx_ver =
    17. #ifdef __clang__
    18. ver_srting(__clang_major__, __clang_minor__, __clang_patchlevel__);
    19. #else
    20. ver_srting(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
    21. #endif
    22. cout << true_cxx << endl;
    23. cout << true_cxx_ver << endl;
    24. return 0;
    25. }