Scientific notation is a convenient method used by scientists to represent very large or very small numbers. It satisfies the regular expression [+-][1-9].
[0-9]+E[+-][0-9]+, that is, the integer part of the number has only 1 digit, and the decimal part has at least 1 digit. The sign of the number and its exponent part must be positive even for positive numbers Give clearly.
The real number is now given in the format of scientific notationA, please write a program to output according to ordinary number notation A, and ensure that all valid bits are reserved. p>
Input format:
Each input contains 1 test case, which is a real number expressed in scientific notationA. The storage length of this number does not exceed 9999 bytes, and the absolute value of its exponent does not exceed 9999.
Output format:
For each test Use case, output in a line according to ordinary number notationA, and ensure that all valid bits are reserved, including the 0 at the end.
input example 1:
+1.23400E-03
Sample output 1:
0.00123400
Sample input 2 :
-1.2E+10
Sample output 2:
-12000000000
p>
Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9].
[0-9] +E[+-][0-9]+ which means that the integer portion has exactly one digit, there is at least one digit in the fractional portion, and the number and its exponent’s signs are always provided even when they are positive.
Now given a real number< span class="base textstyle uncramped">A in scientific notation, you are supposed to printA in the conventional notation while keeping all the significant figures.< /span>
Input Specification:
Each input contains one test case. For each case, there is one line containing the real number A in scientific notation. The number is no more than 9999 bytes in length and the exponent’s absolute value is no more than 9999.< /span>
Output Specification:
For each test case, print in one line the input numberA in the conventional notation, with all the significant figures kept, including trailing zeros.
Sample Input 1:
+1.23400E-03
Sample Output 1:
0.00123400
Sample Input 2:
-1.2E+10
Sample Output 2:
-12000000000
#include
#include
using namespace std;
int main() {
//Data definition and separation
string s;
stack<char> integer;
stack<char> decimal;
stack<char> res;
int mv=0;
cin>>s;
char sf=s[0],sf2; //The first sign bit
int tmp;
for(int i=1;s[i]!='.< /span>';i++){
integer.push(s[i]);
tmp=i+2;
}
for(int i=tmp;s[i ]!='E' ;i++){
decimal.push(s[i]);
tmp=i+3;
}
sf2=s[tmp-1];
for(int i=tmp;i){=mv*10+(s[i]-'< /span>0') ;
mv
}
//Data processing
while(!decimal.empty()){
res.push(decimal.top());
decimal.pop();
}
if(sf2=='+'){
while(mv--){
if(res.empty()) integer.push('< /span>0') ;
else{
integer.push(res.top());
res.pop();
}
}
}
if(sf2=='-'){
while(mv--){
if(integer.empty()) res.push('< /span>0') ;
else{
res.push(integer.top());
integer.pop();
}
}
}
if(!res.empty())res.push(' .' );
while(!integer.empty()){
res.push(integer.top());
integer.pop();
}
if(sf=='-') cout<<sf;
if(res.top()==' .') cout<< 0;
while(!res.empty()){
cout<<res.top();
res.pop();
}
system("pause");
return 0;
}
#include
#include
using namespace std;
int main() {
//Data definition and separation
string s;
stack<char> integer;
stack<char> decimal;
stack<char> res;
int mv=0;
cin>>s;
char sf=s[0],sf2; //The first sign bit
int tmp;
for(int i=1;s[i]!='.< /span>';i++){
integer.push(s[i]);
tmp=i+2;
}
for(int i=tmp;s[i ]!='E' ;i++){
decimal.push(s[i]);
tmp=i+3;
}
sf2=s[tmp-1];
for(int i=tmp;i){=mv*10+(s[i]-'< /span>0') ;
mv
}
//Data processing
while(!decimal.empty()){
res.push(decimal.top());
decimal.pop();
}
if(sf2=='+'){
while(mv--){
if(res.empty()) integer.push('< /span>0') ;
else{
integer.push(res.top());
res.pop();
}
}
}
if(sf2=='-'){
while(mv--){
if(integer.empty()) res.push('< /span>0') ;
else{
res.push(integer.top());
integer.pop();
}
}
}
if(!res.empty())res.push(' .' );
while(!integer.empty()){
res.push(integer.top());
integer.pop();
}
if(sf=='-') cout<<sf;
if(res.top()==' .') cout<< 0;
while(!res.empty()){
cout<<res.top();
res.pop();
}
system("pause");
return 0;
}