12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
#include <iostream> #include <string> using namespace std; void printLine(int); void printTriangle(int); int main() { int height; cout << endl; printLine(1); cout << endl; printLine(4); cout << endl; cout << "What is the height of the triangle? "; cin >> height; cout << endl << endl; printTriangle(height); cout << endl; system ("pause"); return 0; } void printLine(int num) { string c = "*"; for (int i = 1; i <= num; i++) { cout << c << endl; return; } } void printTriangle(int num) { for (int i = 1; i <= num; i++) { cout << " "; printLine(i); } cout << endl; return; }
return;
for