#include <iostream>
using namespace std;
void line_o_stars(int length) {
for (int i = 0; i < length; i++) {
cout << "*";
}
}
void falling_triangle(int start, int decline) {
for (int i = start; i >= 0;) {
line_o_stars(i);
cout << endl;
i -= decline;
}
}
int main() {
int start, decline;
cout << "I would like to make a lovely triangle for you.\n\n";
cout << "Please give the base: ";
cin >> start;
cout << "Please give the decline: ";
cin >> decline;
cout << "\nHere it is!" << endl << endl;
falling_triangle(start, decline);
cout << "\nPretty, huh!\n";
system("pause");
return 0;
}
Back to top