1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <iostream>
#include <iomanip>
int main( int argc, char * argv[] )
{
using namespace std;
string spacing( 2, ' ' ),
big_space( 10, ' ' ),
little_space( 1, ' ' ),
big_stars( big_space.size(), '*' ),
little_stars( little_space.size(), '*' );
cout << left << setw( 11 ) << "(a)" << spacing
<< left << setw( 11 ) << "(b)" << spacing
<< left << setw( 11 ) << "(c)" << spacing
<< left << setw( 11 ) << "(d)" << endl;
for( int i = big_space.size(); i > 0; --i )
{
cout << little_stars << big_space << spacing
<< big_stars << little_space << spacing
<< little_space << big_stars << spacing
<< big_space << little_stars << endl;
little_stars += '*';
big_stars.erase( big_stars.size() - 1, 1 );
little_space += ' ';
big_space.erase( big_space.size() - 1, 1 );
}
return 0;
}
|
(a) (b) (c) (d)
* ********** ********** *
** ********* ********* **
*** ******** ******** ***
**** ******* ******* ****
***** ****** ****** *****
****** ***** ***** ******
******* **** **** *******
******** *** *** ********
********* ** ** *********
********** * * ********** | |