Menu

Int returning from a double

2002-12-07
2012-09-26
  • Nobody/Anonymous

    I am compiling a simple shopping program that is taking a double quantity multiplying it by double price to return a subtotal, but it is returning it as a INT not a Double, I receive the warning in the compile box, my IOS fixed is set, setprecision is on and showpoint is on...any other ideas?? Thanks

     
    • Nobody/Anonymous

      Hmmm, I must be missing something here.  All the stuff you mentioned only controls how a number is displayed, not the nature of the number itself.

      I am having to guess here, but are you doing some calculation that might be casting your float as an integer.

      Of course, I may be mis-interpreting one other thing.  What do you mean by "returning"?  Displaying?  I have a weird filter that looks at the term returning in terms of a function return.

      Wayne

       
    • Curtis Sutter

      Curtis Sutter - 2002-12-07

      Does your function header contain...

      int function (double one, double two)
      {
      return one * two;
      }

      instead of...

      double function (double one, double two)
      {
      return one * two;
      }

      Curtis

       
    • Nobody/Anonymous

      Thanks Curtis...thought that might been the issue..but after a night of Unix,,,,but it worked!! WooHoo

       
    • Curtis Sutter

      Curtis Sutter - 2002-12-07

      no problem

      Curtis

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.