Commit 960d300d authored by Michael's avatar Michael

michael.davityan:exercise_05_24v7

parent b9c52515
......@@ -14,10 +14,11 @@ main()
std::cerr << "Error 1: wrong number(must be odd number from 1->19).\n";
return 1;
}
const int LINE_LIMIT = (lineCount - 1) / 2;
for (int row = LINE_LIMIT; row >= -LINE_LIMIT; --row) {
for (int column = -(LINE_LIMIT - 1); column <= (LINE_LIMIT - std::abs(row)) + 1; ++column) {
std::cout << (column <= std::abs(row) - LINE_LIMIT ? " " : "*");
const int ROW_LIMIT = (lineCount - 1) / 2;
for (int row = -ROW_LIMIT; row <= ROW_LIMIT; ++row) {
const int columnLimit = ROW_LIMIT - std::abs(row);
for (int column = -ROW_LIMIT; column <= columnLimit; ++column) {
std::cout << (column < -columnLimit ? " " : "*");
}
std::cout << std::endl;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment