Mil*_*d R 2 c++ notation
我想知道是否可以使用带变量的科学记数法?
例如:
int n; cin >> n; int x = 1en;
代替
int x = 1e8
可能吗?如果有,怎么样?
Zet*_*eta 6
不可以.科学记数法仅适用于恒定值.这些值在编译时确定,而您想要获取的值在运行时确定.
你必须使用类似的东西int result = pow(10,n).请记住,std::pow返回double值.
int result = pow(10,n)
std::pow
归档时间:
13 年,6 月 前
查看次数:
13873 次
最近记录: