问题:
解答:
#include <iostream>
using namespace std;
const int yearToMonth = 12;
int main()
{
short age = 0;
cout << "请输入您的芳龄:" << endl;
cin >> age;
int months = age * yearToMonth;
cout << age << "岁已经在世" << months << "月了" << endl;
return 0;
}
运行结果:

考查点:
- const
注意:
cosnt修饰的变量不能修改,称其为只读变量.

2024年8月22日20:19:55










![[windows][apache]Apache代理安装](https://i-blog.csdnimg.cn/direct/08ef6ff53e7d4f7d9c08a53fc8555b4d.png)








![[godot] 采用状态机时,如何处理攻击时移动?如“冲撞”](https://i-blog.csdnimg.cn/direct/088bc82883cf4497845ed800eb1f29dc.png)
