#include <iostream>
#include <string>
usingnamespace std;
constint SIZE = 10;
constchar SOLID = '*';
constchar SPACE = ' ';
void plot( int m, int n ) { cout << string( m, SPACE ) + string( n, SOLID ) + '\n'; }
int main()
{
plot( 0, SIZE );
for ( int i = 1 ; i <= SIZE - 1; i++ ) plot( i, 1 );
for ( int i = SIZE - 2; i > 0 ; i-- ) plot( i, 1 );
plot( 0, SIZE );
}
Not actually needed on Unix/Linux since you're using std::cout and not std::wcout: with utf-8 on the internal side (due to u8"..."), the default locale works just fine since it's non-converting for narrow I/O (same as the utf-8 locale actually)