科学计数法 给出 a.deb 的形式 转化为数字 要考虑的情况真的好多 QAQ
#include <iostream>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <algorithm>
#include <algorithm>
using namespace std;
#define PI 3.1415926
int main()
{
string str;
int se,sd,ss,sq,j;//e ,点 ,e后数字
while (getline(cin,str))
{
sd = str.find('.',0);
se = str.find('e',0);
sq = se+1;
ss = 0;
/********************************/
while (sq<str.length())
{
ss*=10;
ss+=str[sq]-'0'; //【字符串变数字】
sq++;
}
/********************************/
str.erase(sd,1);
str = str.substr(0,se-1); //删除e的后续
j = 0;
while (str[j] == '0')
j++;
if(j == str.length()){ //0.0e0 的情况
cout<<'0'<<endl;
continue;
}
if(ss+sd<str.length()) //8.77056e6
str.insert(ss+sd,1,'.');
while ( str[str.length()-1] == '0' || str[str.length()-1] == '.' )
str.erase(str.length()-1,1); //2.0000e3
if (str.length()-sd<=ss) {//末尾补零 2.0e4
int m = ss-str.length()+sd-1;
for (int i = 0; i <= m; i++){
str+='0';
}
}
j = 0;
while (str[j] == '0' && str[j+1]!='.')//0.0023e0
j++;
str = str.substr(j,str.length());
cout<<str<<endl;
}
return 0;
}