Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <sstream>
- #include <string>
- std::string seq_to_str(int start, int end) {
- std::ostringstream out;
- out << "[";
- for (int count = start; count < end; ++count) {
- out << count;
- if (count < end - 1) {
- out << ", ";
- }
- }
- out << "]";
- return out.str();
- }
- int main() {
- std::cout << seq_to_str(1, 10) << "\n";
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement