string中截取子串的函数。

pat-1024 科学计数法

合理利用字符串拼接的方法:

temp =  integral + decimal;

分指数的正负讨论。

1:得到指数,stoi,或者atoi。其中atoi处理string注意使用 string.c_str()函数;

2:指数为负 输出“0.” + temp;

3:指数为正 :判断 指数是否大于decima.size()

大于:输出temp + 多余的0;

小于:输出temp前k位 + ‘.’ + 输出后面位数。

相关文章:

  • 2022-02-22
  • 2022-01-05
  • 2021-12-04
  • 2021-04-22
  • 2022-01-09
  • 2022-01-15
  • 2022-12-23
猜你喜欢
  • 2022-01-20
  • 2021-12-27
  • 2022-02-18
  • 2021-07-16
  • 2021-08-02
  • 2021-12-03
  • 2022-01-09
相关资源
相似解决方案