Hi all
I was wondering if I could have a little help on this. I currently have a code which will make the " * " character print out a triangle pattern. It currently prints out in the format:
but I want it to be printed like this:Code:How many lines? (an example of 4) * * * * * * * * * *
Code:* * * * * * * * * *
The code I am using is:
any ideas on how to make it print out in the format ofCode:#include <iostream> using namespace std; void printStars(int blanks, int starsInLine); int main() { int noOfLines; int counter; int noOfBlanks; cout << "How many lines?"; cin >> noOfLines; while (noOfLines < 0 || noOfLines > 4) { cout << "Number of star lines should be between 1 and 4" << endl ; cout << "How many lines?"; cin >> noOfLines; } cout << endl << endl ; noOfBlanks = 30; for (counter = 1; counter <= noOfLines; counter++) { printStars(noOfBlanks, counter) ; noOfBlanks--; } return 0; } void printStars(int blanks, int starsInLine) { int count; for (count = 1; count <= blanks; count++) cout << ' '; for (count = 1; count <= starsInLine; count++) cout << " * "; cout << endl ; }
*
* *
* * *
* * * *
would be much appreciated.


CornedBee