float data type question...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dmitrii PapaGeorgio

    float data type question...

    how would i print a number in float value without negative numbers?
    thanks for any advice...

  • Mike Wahler

    #2
    Re: float data type question...


    "Dmitrii PapaGeorgio" <james69@woh.rr .comNOSPAM> wrote in message
    news:nICob.738$ gD1.405@fe2.col umbus.rr.com...[color=blue]
    > how would i print a number in float value without negative numbers?
    > thanks for any advice...[/color]


    if(!(float_valu e < 0))
    std::cout << float_value << '\n';

    -Mike


    Comment

    • Dmitrii PapaGeorgio

      #3
      Re: float data type question...

      Mike Wahler wrote:[color=blue]
      > "Dmitrii PapaGeorgio" <james69@woh.rr .comNOSPAM> wrote in message
      > news:nICob.738$ gD1.405@fe2.col umbus.rr.com...
      >[color=green]
      >>how would i print a number in float value without negative numbers?
      >>thanks for any advice...[/color]
      >
      >
      >
      > if(!(float_valu e < 0))
      > std::cout << float_value << '\n';
      >
      > -Mike
      >
      >[/color]
      i need to "convert" it to a positive number...

      Comment

      • lilburne

        #4
        Re: float data type question...

        Dmitrii PapaGeorgio wrote:
        [color=blue]
        > Mike Wahler wrote:
        >[color=green]
        >> "Dmitrii PapaGeorgio" <james69@woh.rr .comNOSPAM> wrote in message
        >> news:nICob.738$ gD1.405@fe2.col umbus.rr.com...
        >>[color=darkred]
        >>> how would i print a number in float value without negative numbers?
        >>> thanks for any advice...[/color]
        >>
        >>
        >>
        >>
        >> if(!(float_valu e < 0))
        >> std::cout << float_value << '\n';
        >>
        >> -Mike
        >>
        >>[/color]
        > i need to "convert" it to a positive number...
        >[/color]

        #include <cmath>

        std::abs(float_ value);

        Comment

        Working...