+_____+
_+___+
__+_+
___+
imagine the _ are not there these represent a space 'whitespace'
this is a console application btw
this cannot be done with cout's it must be done with for loops, here is a sample of the rest of the patterns if you can get the drift of the code style
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int col, row;
char mychar = '+';
//Pattern 1
for (col=1; col <= 5; ++col)
{
cout << endl;
for (row=0; row < col; ++row)
{
cout << mychar;
}
}
//Pattern 1 part 2
for (col=0; col <= 5; ++col)
{
cout << endl;
for (row=4; row >= col; --row)
{
cout << mychar;
}
}
//Pattern 2
cout << endl;
for (col=0; col < 5; ++col)
{
cout << endl;
for (row=0; row < 4 - col; ++row)
{
cout << " ";
}
for (row=0; row < 2 * col + 1; ++row)
{
cout << mychar;
}
}
//Pattern 3
cout << endl;
return 0;
}
Edited by SlitNek, 13 April 2006 - 03:50 PM.