Return the smallest of 2 doubles

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AmmarShah
    New Member
    • Mar 2010
    • 3

    Return the smallest of 2 doubles

    how to implement a method smallest which recieves two parameters of double type. it will return the smallest number of them?
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    So it could be a function which has two integers passed to it and it picks and returns the smallest. Post your code and tell us where you are having trouble.

    Comment

    • Dheeraj Joshi
      Recognized Expert Top Contributor
      • Jul 2009
      • 1129

      #3
      I assume you already wrote the code. So, what is the problem you are facing? Any errors, warnings, unexpected behaviors?

      Regards
      Dheeraj Joshi

      Comment

      • AmmarShah
        New Member
        • Mar 2010
        • 3

        #4
        problem

        this is the problem . I need to write down the code for this and i hav no idea how to?

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          Can you write any function?
          Can you then alter that to accept 2 doubles are parameters?
          Can you then alter that to return a double value?
          Can you pick out from the C++ operators which operator will allow you to make the required comparison?

          This site does not provide solutions to people who have not made an attempt to write their own solution in the first place. Particularly to such a simple problem as this which quite literally requires a function declaration and a single line of code.

          If you can not write a function like this you seriously need to re-read you text books and tutorial material.

          Comment

          Working...