Mathcad自动转换

时间:2016-03-11 16:37:32

标签: data-conversion mathcad

有人可以告诉我如何使用度数值,就像它是正常值一样吗? 例如:

#include <iostream>
#include <iomanip>


class hexa_s
{
   mutable std::ostream *_out;

   template<typename T>
   const hexa_s& operator << (const T & data) const
   {
       *_out << std::internal << std::setfill( '0' ) << std::hex << std::showbase << std::setw( sizeof( T ) * 2 ) << data;

       return *this;
   }

   friend const hexa_s& operator <<( std::ostream& out, const hexa_s& b )
   {
       b._out = &out;
       return b;
   }
};

hexa_s hexa( )
{
    return hexa_s( );
}


int main()
{
    int value = 4;

    std::cout << hexa << value << std::endl;

    return 0;
}

我希望y等于120.

2 个答案:

答案 0 :(得分:0)

第二个等式15中的

是第二个等式中的度数加法度

    x := 15deg
   `y := 4 * (x + 15deg)

答案 1 :(得分:0)

根据Ivan的回答,Mathcad会自动将度数转换为弧度,因此您实际上将以弧度表示的15度加到15(弧度)。虽然Mathcad通常会标记单位不匹配,但弧度具有Dimension 1(即,它们是无量纲的),而Mathcad将它们视为数字(根据SI)。

以上是一个有希望的更多解释性的Mathcad版本!

enter image description here