编程序生成一张从英尺到米的转换表

#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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值