// Program: ex1c_template.cpp // Author: ... #include #include typedef std::vector::iterator Vit; typedef std::vector::const_iterator Cvit; // PRE: [begin, end) is a valid range // POST: fills the range with the following pattern // 1 2 2 3 3 3 4 4 4 4 ... // The pattern is cut off as soon as the range is full. void n_times_n_pattern (Vit begin, Vit end) { // [Your code ...] } int main () { // Prepare vector std::cout << "Length =? "; unsigned int n; std::cin >> n; // Fill range with pattern std::vector pattern (n); n_times_n_pattern(pattern.begin(), pattern.end()); // Output pattern for (Cvit i = pattern.begin(); i < pattern.end(); ++i) std::cout << *i << " "; std::cout << "\n"; return 0; }