Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void printStars(int count, int num);
- int main() {
- cout << "Enter the number for the largest line to print: ";
- int x;
- cin >> x;
- int ind = 1;
- printStars(ind, x);
- system("PAUSE");
- return 0;
- }
- void printStars(int count, int num)
- {
- for (int i = 0; i < count; i++) cout << "*";
- cout << endl;
- if (count < num) printStars(count + 1, num);
- for (int i = 0; i < count; i++) cout << "*";
- cout << endl;
- }
Add Comment
Please, Sign In to add comment