the most basic question ever

This is a discussion on the most basic question ever within the C++ Programming forums, part of the General Programming Boards category; hi there, yep, you better believe it, there are people out there with questions like this: I'm trying to print ...

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    5

    the most basic question ever

    hi there,

    yep, you better believe it, there are people out there with questions like this:

    I'm trying to print out a function that returns a number of the type double:

    cout << d1->getDrainNumber();

    now, the problem is that the output is:

    3.4556e+006

    which is correct, but is there a way to get it like this:

    3455600 ?

    please help me

    thank you

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    It looks like your formatting is incorrect. That looks to be scientific notation, take it out of scientific notation and then output the value as you want..very wierd output, and if that isn't scientific notation then I really have no clue how your getting that value..
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >It looks like your formatting is incorrect. That looks to be scientific notation,
    >take it out of scientific notation and then output the value as you want..very
    >wierd output, and if that isn't scientific notation then I really have no clue
    >how your getting that value..
    He knows that the formatting is incorrect. That's what the whole question is dealing with. He wants to know how to get it to print without using scientific notation.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    use
    Code:
    cout.setf(ios::fixed);
    to go from scientific to fixed notation and
    Code:
    cout.precision(n);
    where n is an integer to set the number of places after the decimal.

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    5
    thanks, that helped

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A basic math programming question
    By hebali in forum C Programming
    Replies: 38
    Last Post: 02-25-2008, 04:18 PM
  2. Basic question about GSL ODE func RK4
    By cosmich in forum Game Programming
    Replies: 1
    Last Post: 05-07-2007, 03:27 AM
  3. Basic question about RK4
    By cosmich in forum C++ Programming
    Replies: 0
    Last Post: 05-07-2007, 03:24 AM
  4. A very basic question
    By AshFooYoung in forum C Programming
    Replies: 8
    Last Post: 10-07-2001, 04:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21