fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <string>
  4.  
  5. using namespace std;
  6. class greet
  7. {
  8. public:
  9.  
  10. void hello(string name)
  11. {
  12. cout << "Hello, " + name + "!" << endl;
  13. }
  14. };
  15.  
  16. int main()
  17. {
  18. greet user;
  19. char const* name = std::getenv("USER");
  20. user.hello(name);
  21. return 0;
  22. }
Runtime error #stdin #stdout #stderr 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid