1
0
forked from newde/homework
Files
homework/260202
newde 1d92199f8e 新增 260202
99乘法表的代码
2026-02-02 11:01:02 -05:00

18 lines
534 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include <iostream>
#include <iomanip> // 用于对齐输出
using namespace std;
int main() {
// 外层循环控制行数 (1-9)
for (int i = 1; i <= 9; ++i) {
// 内层循环控制每行显示的列数
for (int j = 1; j <= i; ++j) {
// 输出格式j * i = 结果
// 使用 setw(2) 确保结果占两位,输出更整齐
cout << j << " * " << i << " = " << setw(2) << i * j << " ";
}
// 每行结束后换行
cout << endl;
}
return 0;
}