Hey all,

I'm busy with an assignment for which a question, due to being too complicated, has been cancelled (i.e. no longer required to be done).

The lecturers told us that if we still included this question in our assignment answers, they would give us the marks for it if we attempted it (even if the final program doesn't work).

The question is:

Suppose we want to display the following pattern on the screen:

&******&******&******&******&******&******&******&

*&******&******&******&******&******&******&******

**&******&******&******&******&******&******&*****

***&******&******&******&******&******&******&****

**&******&******&******&******&******&******&*****

*&******&******&******&******&******&******&******

&******&******&******&******&******&******&******&

"The size of the pattern is determined by counting the number of groups of '*' characters in the first line, or the number of rows in the pattern. Note that the pattern in the first line starts with an '&' character and ends with an '&' character, with each group of size - 1 '*' characters seperated by an '&' character as well. The size of the above pattern is 7. Note that the input value for the size of the pattern must be an odd number. A pattern of size 5 will look as follows:"

&****&****&****&****&****&

*&****&****&****&****&****

**&****&****&****&****&***

*&****&****&****&****&****

&****&****&****&****&****&

Question 4a: one value parameter

"We give the main function below. Write a function *drawPattern* that will display such a pattern on the screen. The function must have one parameter of type *int*, representing the size of the pattern. Use the main function and input 7 as the size. Make sure the pattern displays correctly.

*Hint:* Use a nested *for* loop. The outer loop runs from *1* to *size/2+1*. This will handle the pattern from the start row to the middle row (including the middle row). The inner *for* loop runs from size *1* to *size * size + 1*, completing the row. Then another nested *for* loop handles the rest of the pattern. i.e. the outer loop runs from size/2 to 1, decrementing the loop counter. This is done to make the pattern turn to the left. The inner loop works the same as for the first nested for loop. Test the program with different sizes."

This is the fragment of the program we have been provided with:

```
#include <iostream>
using namespace std;
//The required function [B]drawPattern[/B] should be inserted here.
(that which I have inserted is in bold)
[B]void drawPattern (int ptrnSize)
{
for (int i = 1; i <= ptrnSize/2 +1; i++)
{
for (int j = 1; j <= ptrnSize * ptrnSize +1; j++)
}[/B]
int main( )
{
int size = 0;
do
{
cout << endl << "Please enter the size of the pattern. "
<< endl;
cout << "(You must enter an odd number) : " << endl;
cin >> size;
}while (size % 2 !=1);
drawPattern (size);
return 0;
}
```

could anyone please assist me as it would only benefit me to gain these marks.

any help would be much appreciated,

Brandon.