C++ Lab 4

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324750643&siteId=291194637