i need help

Discussion in 'C++' started by h168210@gmail.com, Oct 22, 2006.

  1. Guest

    hi,i have a aquestion that i don't know how to compare the smallest and
    the largest between five intergers.could anyone help me,thanks.
    , Oct 22, 2006
    #1
    1. Advertising

  2. Phlip Guest

    h168210 wrote:

    > hi,i have a aquestion that i don't know how to compare the smallest and
    > the largest between five intergers.could anyone help me,thanks.


    Sit down with your tutorial and read it, from the front cover, until you are
    well past the answer. Do not return to a computer until you do this.
    (Especially to post!;)

    --
    Phlip
    http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
    Phlip, Oct 22, 2006
    #2
    1. Advertising

  3. David Harmon Guest

    On 21 Oct 2006 20:36:19 -0700 in comp.lang.c++,
    wrote,
    >hi,i have a aquestion that i don't know how to compare the smallest and
    >the largest between five intergers.could anyone help me,thanks.


    Show the code that you have written. Describe how the result
    differs from what you wanted. Ask specific questions.

    This issue is covered in Marshall Cline's C++ FAQ. See the topic
    "[5.2] How do I get other people to do my homework problem for me?"
    It is always good to check the FAQ before posting. You can get the
    FAQ at:
    http://www.parashift.com/c -faq-lite/

    See the welcome message posted twice per week in comp.lang.c++ under
    the subject "Welcome to comp.lang.c++! Read this first." or
    available at http://www.slack.net/~shiva/welcome.txt
    David Harmon, Oct 22, 2006
    #3
  4. Daniel T. Guest

    Daniel T., Oct 22, 2006
    #4
  5. Jim Langston Guest

    <> wrote in message
    news:...
    > hi,i have a aquestion that i don't know how to compare the smallest and
    > the largest between five intergers.could anyone help me,thanks.


    Few ways to do it, depending on how you want to go. Simple way is put them
    into a sorted contain, and then get the largest and the smallest.

    Another way, put them in some type of container (array, vector, etc..) and
    use a for loop going through each one comparing if it's smaller or greater
    than saved values.

    Sounds like a homework question, so I'm not going to give you any code.
    Jim Langston, Oct 22, 2006
    #5
  6. Salt_Peter Guest

    wrote:
    > hi,i have a aquestion that i don't know how to compare the smallest and
    > the largest between five intergers.could anyone help me,thanks.


    Forget the smallest and the largest of 5 integers.

    How do you declare an integer variable and initialize it?
    How do you then compare 2 variables?
    Show the code.
    Salt_Peter, Oct 22, 2006
    #6
  7. Guest

    wrote:
    > hi,i have a aquestion that i don't know how to compare the smallest and
    > the largest between five intergers.could anyone help me,thanks.


    The smallest will always be smaller than the largest, unless all five
    integers are equal, in which case the smallest is equal to the largest.
    Easy! :)
    , Oct 22, 2006
    #7
  8. Mike Wahler Guest

    <> wrote in message
    news:...
    > hi,i have a aquestion that i don't know how to compare the smallest and
    > the largest between five intergers.could anyone help me,thanks.


    int main()
    {
    int i[] = {1, 2, 3, 4, 5}; /* five integers */
    i[0] == i[4]; /* compare smallest with largest */
    return 0;
    }

    -Mike
    Mike Wahler, Oct 22, 2006
    #8
  9. Eric Guest

    Mike Wahler wrote:
    > <> wrote in message
    > news:...
    >> hi,i have a aquestion that i don't know how to compare the smallest and
    >> the largest between five intergers.could anyone help me,thanks.

    >
    > int main()
    > {
    > int i[] = {1, 2, 3, 4, 5}; /* five integers */
    > i[0] == i[4]; /* compare smallest with largest */
    > return 0;
    > }
    >
    > -Mike
    >
    >


    I bet you could have worked "between" in somehow.
    Eric, Oct 22, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TN Bella
    Replies:
    1
    Views:
    2,471
    Edward
    Jun 18, 2004
  2. Teep
    Replies:
    2
    Views:
    765
    Larry Marburger
    Jun 21, 2004
  3. John
    Replies:
    1
    Views:
    394
    John C. Bollinger
    Aug 19, 2004
  4. =?Utf-8?B?Q2hyaXM=?=

    Help Help. I really need some help with this

    =?Utf-8?B?Q2hyaXM=?=, Jan 31, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    560
    =?Utf-8?B?SmFzb24gVmVybWlsbGlvbg==?=
    Jan 31, 2007
  5. ElementX
    Replies:
    9
    Views:
    491
    RedGrittyBrick
    Oct 1, 2008
Loading...

Share This Page