当前位置: 首页>>代码示例>>C++>>正文


C++ Velocity::GetValue方法代码示例

本文整理汇总了C++中Velocity::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Velocity::GetValue方法的具体用法?C++ Velocity::GetValue怎么用?C++ Velocity::GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Velocity的用法示例。


在下文中一共展示了Velocity::GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SolveAccelerationProblems1

void SolveAccelerationProblems1()
{
  //1. A flower pot falls from a windowsill 25.0 m above the sidewalk.   
  //   How much time does a person below have to move out of the way?  
  //   How fast is the flower pot moving when it strikes the ground? 
  Meter const potfalls( 25. );
  SquareSecond const falloffsquaretime = (potfalls * 2.) / Acceleration3( 9.8 );
  Second const rep1 = sqrt( falloffsquaretime );
  Velocity const rep1_2 = potfalls / rep1;
  Scalar const _rep1 = rep1.GetValue();
  Scalar const _rep1_2 = rep1_2.GetValue();
  Assert( fequal( _rep1, 2.2587697572631282 ) );
  Assert( fequal( _rep1_2, 11.067971810589327  ) );

  //2. A plane, starting from rest at one end of a runway, undergoes a 
  //   constant acceleration of 1.6 m/s2 for a distance of 1600 m before 
  //   takeoff.  What is its speed upon takeoff?  What is the time required 
  //   for takeoff?
  Meter const planedistance( 1600. );
  SquareSecond const squaretime2 = (planedistance * 2.) / Acceleration3( 1.6 );
  Second const rep2 = sqrt( squaretime2 );
  Velocity const rep2_2 = planedistance / rep2;
  Scalar const _rep2 = rep2.GetValue();
  Scalar const _rep2_2 = rep2_2.GetValue(); 
  Assert( fequal( _rep2, 44.721359549995796 ) );
  Assert( fequal( _rep2_2, 35.777087639996637 ) );

}
开发者ID:,项目名称:,代码行数:28,代码来源:


注:本文中的Velocity::GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。