void Graph::draw() { int i, j; for (i= 0 ;i<size;i++ ){ //The first layer loop controls the number of layers for (j = 0 ; j < size - i; j++ ) { //The second layer loop controls the number of spaces cout << ' '; } for (j = 0 ; j < 2 * i- 1 ;j++ ) { //The second layer loop controls the number of output symbols cout << symbol; } cout << endl; } }
The second question will be uploaded later