HLPL2/Hw1/task2.cpp

42 lines
645 B
C++

#include <iostream>
#include <string>
using namespace std;
void part1(uint N, uint M)
{
for (uint n = 0; n < N; n++) {
for (uint m = 0; m < M; m++) {
cout << "*";
}
cout << "\n";
}
cout << "\n";
}
void part2(uint N, uint M)
{
for (uint n = 0; n < N; n++) {
if (n < M)
for (uint i = 0; i < M - n; i++) {
cout << " ";
}
for (uint j = 0; j < n * 2; j++) {
cout << "*";
}
cout << "\n";
}
cout << "\n";
}
int main()
{
uint N = 6;
uint M = 6;
part1(N, M);
part2(N, M);
return 0;
}