I have another program to write, i will appreciate if somebody can
help......prompts the user to enter positive integer, and then prints
out four triangles
For Example: If we enter 4 it should shows
*
* *
* * *
* * * *
* * * *
* * *
* *
*
* * * *
* * *
* *
*
*
* *
* * *
* * * *
I have also tried to create this program but i couldn't be able to
correct the formating of "*".
UW PICO(tm) 4.10
File: triangle.cpp
#include <iostream>
using namespace std;
int main()
{
cout << "Enter a character:>";
int n;
cin >n;
for ( int row = 0; row < n; row++ )
{
for ( int column = 0; column <= row; column++ )
cout << ' ';
for ( int column = 0; column < (3 - row); column++ )
cout << " * ";
cout << " "<< endl;
cout << endl;
}
for ( int row = 0; row < n; row++ )
{
for ( int column = 0; column <= (3 - row); column++ )
cout << " * ";
cout << " ";
cout << endl;
}
cout<<endl;
for ( int row = 0; row < n; row++ )
{
for ( int column = 0; column <= row; column++ )
cout << " * ";
cout << " ";
cout << endl;
}
cout<<endl;
for ( int row = 0; row < n; row++ )
{
for ( int column = 0; column < row; column++ )
cout << ' ';
for ( int column = 0; column <= (3 - row);
column++ )
cout << " * ";
cout << endl;
}
return 0;
} // function main