#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;
}
cs-142/triangle-function.txt · Last modified: 2015/02/12 09:10 by kseppi
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0