水题~~
c++中保留小数点后面指定位数,可以用
#include<iomanip>
......
cout<<setprecision(2)<<std::fixed<<n<<endl;
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double x,y;
cin>>x;
if(x==999)
{
cout<<"End of Output\n";
return 0;
}
while(cin>>y,y!=999)
{
cout<<setprecision(2)<<std::fixed<<y-x<<endl;
x=y;
}
cout<<"End of Output\n";
return 0;
}