for循环应用

#include <iostream>
using namespace std;
int main()
{
 double earthweight;
 double moonweight;
 int counter;
 
 counter=0;
 
 for(earthweight=1.0;earthweight<=100.0;earthweight++){
  moonweight=earthweight*0.17;
 cout<<earthweight<<"earth-pounds is equivalent to";
 cout<<moonweight<<"moon-pounts.\n";
      counter++;
 if(counter==25){
  cout<<"\n";
 }
 }
 return 0;
}
posted @ 2019-12-19 15:17  aarin  阅读(130)  评论(0)    收藏  举报