doxgen 中用<table>的写法来绘制3行3列的表格
时间: 2024-05-02 10:16:55 浏览: 97
可以按照以下的方式使用 `<table>` 标签来绘制一个 3 行 3 列的表格:
```c++
/**
* @brief A 3x3 table
*
* +---+---+---+
* | 1 | 2 | 3 |
* +---+---+---+
* | 4 | 5 | 6 |
* +---+---+---+
* | 7 | 8 | 9 |
* +---+---+---+
*/
void table_3x3() {
std::cout << "+---+---+---+\n";
std::cout << "| 1 | 2 | 3 |\n";
std::cout << "+---+---+---+\n";
std::cout << "| 4 | 5 | 6 |\n";
std::cout << "+---+---+---+\n";
std::cout << "| 7 | 8 | 9 |\n";
std::cout << "+---+---+---+\n";
}
```
当然,你也可以使用 `<table>` 标签来实现相同的效果:
```c++
/**
* @brief A 3x3 table
*
* <table>
* <tr>
* <td>1</td>
* <td>2</td>
* <td>3</td>
* </tr>
* <tr>
* <td>4</td>
* <td>5</td>
* <td>6</td>
* </tr>
* <tr>
* <td>7</td>
* <td>8</td>
* <td>9</td>
* </tr>
* </table>
*/
void table_3x3() {
std::cout << "<table>\n";
std::cout << " <tr>\n";
std::cout << " <td>1</td>\n";
std::cout << " <td>2</td>\n";
std::cout << " <td>3</td>\n";
std::cout << " </tr>\n";
std::cout << " <tr>\n";
std::cout << " <td>4</td>\n";
std::cout << " <td>5</td>\n";
std::cout << " <td>6</td>\n";
std::cout << " </tr>\n";
std::cout << " <tr>\n";
std::cout << " <td>7</td>\n";
std::cout << " <td>8</td>\n";
std::cout << " <td>9</td>\n";
std::cout << " </tr>\n";
std::cout << "</table>\n";
}
```
这样使用 `<table>` 标签绘制表格可以更加灵活和方便地控制表格样式,同时也可以方便地进行表格跨行和跨列的合并。
阅读全文