#include"stdio.h"#include<iostream>
using namespace std;voidmain(){int n;
cout<<"Please input the number of each kind of pieces :"<<endl;
cin >> n;
bool *str = new bool[n];
cout <<"The result is : "<< endl;for(int i =0; i <2*n; i++){if(i>=n){
str[i]= false;continue;}
str[i]= true;}for(int i =0; i <2* n; i++){printf("%3c", str[i]?'*':'0');}printf("\n");
bool temp;int num = n -1;int switchTime = n -1;for(; num <2* n -2; num++, switchTime--){for(int i =0,k=num; i < switchTime; i++,k--){
temp = str[k];
str[k]= str[k +1];
str[k +1]= temp;}for(int j =0; j <2* n; j++){printf("%3c", str[j]?'*':'0');}printf("\n");}system("pause");}