fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class SayWorld{
  6. public:
  7. SayWorld(){
  8. cout << "World!" << endl;
  9. }
  10. };
  11.  
  12. int main() {
  13. //Only gets outputted, if the lines, that don't work are commented out:
  14. cout << "Hello ";
  15.  
  16. // Works:
  17. // cout << "World!" << endl;
  18.  
  19. // Doesn't work:
  20. SayWorld sw;
  21.  
  22. // Also doesn't work:
  23. string str("Hi again!");
  24. cout << str << endl;
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
Hello World!
Hi again!