does anyone know how to

This is a discussion on does anyone know how to within the C++ Programming forums, part of the General Programming Boards category; do max and min coding?...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    32

    does anyone know how to

    do max and min coding?

  2. #2
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    401
    Are you talking about a function that will take some numbers, compare them, and tell you which one is the maximum or minimum of the set?

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    32
    Write a program in C++ that takes three int values interactively
    from the user and prints them in ascending order.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by sjcc View Post
    Write a program in C++ that takes three int values interactively
    from the user and prints them in ascending order.
    There is a C++ forum here (click on "General Programming Boards" to find it); you might get more better and quick answers there.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,639
    Moved to C++ programming forum.

    You should #include <algorithm> and <vector>, read the numbers into a std::vector, then std::sort and print them. If the number of numbers is fixed at three, a little swapping as in bubble sort will suffice.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by sjcc View Post
    Write a program in C++ that takes three int values interactively
    from the user and prints them in ascending order.
    Do your own homework.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Popular pages Recent additions subscribe to a feed

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