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


C++ Converter::FloatToExponent方法代码示例

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


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

示例1: EPSSetText

void Key::EPSSetText(const Options& draw, const Partition& part) const
{
  textStrings.resize(part.values.size());

  const Converter convert;

  auto text = std::begin(textStrings);

  if (draw.chart_colour == ChartColour::MASSEXCESSERROR)
    {
      auto low  = convert.FloatToNdp(part.values[0].value, 1);
      auto high = convert.FloatToNdp(part.values[1].value, 1);

      *text = "1 TR (Stable \\() TotalWidth sh\n1 S (d) TotalWidth sh\n1 TR (m < ";
      *text += low;
      *text += " keV\\)) TotalWidth sh TestWidth\n";
      std::advance(text, 1);

      *text = "1 TR (Stable \\() TotalWidth sh\n1 S (d) TotalWidth sh\n1 TR (m > ";
      *text += low;
      *text += " keV\\)) TotalWidth sh TestWidth\n";
      std::advance(text, 1);

      *text = "1 S (d) TotalWidth sh\n1 TR (m < ";
      *text += low;
      *text += " keV) TotalWidth sh TestWidth\n";
      std::advance(text, 1);

      *text = "1 TR (  ";
      *text += low;
      *text += " keV < ) TotalWidth sh\n1 S (d) TotalWidth sh\n1 TR (m < ";
      *text += high;
      *text += " keV) TotalWidth sh TestWidth\n";
      std::advance(text, 1);

      int index = 1;
      while ((text - std::begin(textStrings)) < static_cast<int>(part.values.size() - 1))
        {
          low   = high;
          high  = convert.FloatToNdp(part.values[index + 1].value, 1);
          *text = "1 TR (";
          *text += low;
          *text += " keV < ) TotalWidth sh\n1 S (d) TotalWidth sh\n1 TR (m < ";
          *text += high;
          *text += " keV) TotalWidth sh TestWidth\n";
          std::advance(text, 1);
          ++index;
        }

      *text = "1 S (d) TotalWidth sh\n1 TR (m > ";
      *text += high;
      *text += " keV) TotalWidth sh TestWidth\n";
    }
  else if (draw.chart_colour == ChartColour::REL_MASSEXCESSERROR)
    {
      auto low  = convert.FloatToExponent(part.values[0].value);
      auto high = convert.FloatToExponent(part.values[1].value);

      *text = "1 S (d) TotalWidth sh\n1 TR (m/m < ) TotalWidth sh\n";
      *text += std::get<0>(low);
      *text += " ";
      *text += std::get<1>(low);
      *text += std::get<2>(low);
      *text += " exponent TestWidth\n";
      std::advance(text, 1);

      *text = std::get<0>(low);
      *text += " ";
      *text += std::get<1>(low);
      *text += std::get<2>(low);
      *text += " exponent printUnit ";
      *text += std::get<0>(high);
      *text += " ";
      *text += std::get<1>(high);
      *text += std::get<2>(high);
      *text += " exponent TestWidth\n";
      std::advance(text, 1);

      int index = 1;
      while ((text - std::begin(textStrings)) < static_cast<int>(part.values.size() - 1))
        {
          low  = high;
          high = convert.FloatToExponent(part.values[index + 1].value);

          *text = std::get<0>(low);
          *text += " ";
          *text += std::get<1>(low);
          ;
          *text += std::get<2>(low);
          *text += " exponent printUnit ";
          *text += std::get<0>(high);
          *text += " ";
          *text += std::get<1>(high);
          *text += std::get<2>(high);
          *text += " exponent TestWidth\n";
          std::advance(text, 1);
          ++index;
        }

      *text = "1 S (d) TotalWidth sh\n1 TR (m/m > ) TotalWidth sh\n";
//.........这里部分代码省略.........
开发者ID:php1ic,项目名称:inch,代码行数:101,代码来源:key.cpp


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