scientific notation

Discussion in 'C#' started by aleksandar12345, Apr 26, 2013.

  1. #1
    hi
    a need to write a code in c++ given from my profesor ,to input decimal number
    and the output to be number in Scientific notation with 32 bits can somebody help me pls!!
     
    aleksandar12345, Apr 26, 2013 IP
  2. wren11

    wren11 Active Member

    Messages:
    89
    Likes Received:
    10
    Best Answers:
    3
    Trophy Points:
    53
    #2
    this seems easy enough:

    #include "stdafx.h"
    #include <math.h>
     
    int _tmain(int argc, _TCHAR* argv[])
    {
        double value = 1235;
     
        double exponent = floor(log(value) / 2.30258509299404568402);
        double mantissa = value / pow(10, exponent);
     
        return 0;
    }
     
    
    PHP:
     
    wren11, Apr 27, 2013 IP