fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6. char MyCharArray[] = "Hello, Cruel\0World!";
  7. std::string MyString (MyCharArray, sizeof(MyCharArray)-1);
  8. std::cout << MyString << std::endl;
  9. std::cout << "Hello, Cruel" << std::ends << "World!" << std::endl;
  10. }
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
Hello, CruelWorld!
Hello, CruelWorld!