Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <sstream>
  4. #include <string>
  5.  
  6. std::string seq_to_str(int start, int end) {
  7. std::ostringstream out;
  8. out << "[";
  9. for (int count = start; count < end; ++count) {
  10. out << count;
  11. if (count < end - 1) {
  12. out << ", ";
  13. }
  14. }
  15. out << "]";
  16. return out.str();
  17. }
  18.  
  19. int main() {
  20. std::cout << seq_to_str(1, 10) << "\n";
  21. return EXIT_SUCCESS;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement