This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
lessons/C++/lesson2/task7.cpp
2023-07-16 13:23:25 +00:00

21 lines
519 B
C++

#include <iostream>
#include <string>
int main() {
std::string value = std::string();
value.reserve(9);
for (int count = 4; count >= 0; count--) {
value.clear();
for (int j = 0; j < count; j++) {
value.push_back(' ');
}
int limit = 9 - count * 2;
for (int j = 0; j < limit; j++) {
value.push_back('*');
}
for (int j = 0; j < count; j++) {
value.push_back(' ');
}
std::cout << value << '\n';
}
}