fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5. class ExportStr{
  6. vector<string> m_Str;
  7. public:
  8. ExportStr& Word(string str){
  9. if(!m_Str.empty()) m_Str.push_back(" ");
  10. m_Str.emplace_back(str);
  11. return *this;
  12. }
  13. void End(){
  14. for(auto Word : m_Str)
  15. cout << Word;
  16. cout << "." << endl;
  17. }
  18. };
  19.  
  20. int main() {
  21. ExportStr Hoge;
  22. Hoge.Word("This").Word("is").Word("a").Word("Pen").End();
  23. return 0;
  24. }
Success #stdin #stdout 0s 3232KB
stdin
Standard input is empty
stdout
This is a Pen.