#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main( )
{int i,j;
cout<<" Inch2Meter:"<<endl;
for(j=0;j<10;j++)
cout<<setw(7)<<j;
cout<<endl;
for(i=0;i<10;i++)
for(j=0;j<10;j++)
{cout<<setiosflags(ios::fixed)<<setprecision(2);
cout<<i<<setw(6)<<(10*i+j)/3.28;
if(j>0&&j%9==0)//换行
cout<<endl;}
return 0;
}
运行结果:
Inch2Meter:
0 1 2 3 4 5 6 7 8 9
0 0.000 0.300 0.610 0.910 1.220 1.520 1.830 2.130 2.440 2.74
1 3.051 3.351 3.661 3.961 4.271 4.571 4.881 5.181 5.491 5.79
2 6.102 6.402 6.712 7.012 7.322 7.622 7.932 8.232 8.542 8.84
3 9.153 9.453 9.763 10.063 10.373 10.673 10.983 11.283 11.593 11.89
4 12.204 12.504 12.804 13.114 13.414 13.724 14.024 14.334 14.634 14.94
5 15.245 15.555 15.855 16.165 16.465 16.775 17.075 17.385 17.685 17.99
6 18.296 18.606 18.906 19.216 19.516 19.826 20.126 20.436 20.736 21.04
7 21.347 21.657 21.957 22.267 22.567 22.877 23.177 23.487 23.787 24.09
8 24.398 24.708 25.008 25.308 25.618 25.918 26.228 26.528 26.838 27.13
9 27.449 27.749 28.059 28.359 28.669 28.969 29.279 29.579 29.889 30.18
Press any key to continue