题目描述
茵茵今年已经六年级了,爸爸给她报了一个学习程序设计的班。 第一节课上,老师讲的就是如何输入一个数,再原样输出出来。 以现在的你看来,挺容易的是不? 那么,就请你也写出一个一样的程序吧。
输入
只有一个数(可能是小数,也可能是整数) n ,保证 0 < n < 2000000000。
输出
只有一个数 ,并与输入文件完全相同。
样例
输入 复制
3.5
输出 复制
3.5
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
double n=0.0,nt=0.0;
//long 2147483600
long long nt_ls=0,s=0;
cin>>n;
if(n>0 && n<2000000000){
nt=n;
for(int i=0;;i++){
nt_ls=(long long)nt;
cout<<nt<<' '<<nt_ls<<endl;
if(nt<=nt_ls){
break;
}
nt=nt*10;
s+=1;
if(nt>2000000000){
break;
}
}
cout<<setiosflags(ios::fixed)<<setprecision(s)<<n;
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
float n=0.0;
long long nt=0;
//int s=0;
cin>>n;
if(n>0){
nt=(long long )n;
cout<<nt;
n=(n-nt*1.0);
cout<<'.';
//cout<<"------------------"<<n<<"--------"<<endl;
nt=(long long)n;
while(nt < n){
n = n *10;
nt = (int)n;
}
cout<<nt<<endl;
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
string sz;
cin>>sz;
cout<<sz;
return 0;
}