CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: keang

Search: Search took 0.23 seconds.

  1. Replies
    14
    Views
    12,635

    Re: Problem with -negative output

    That's because you have a spurious semi-colon at the end of the if statement line.
  2. Replies
    14
    Views
    12,635

    Re: Problem with -negative output

    Yep.

    Personally I prefer the second approach as it guarantees the correct answer without any further processing but if your teacher has suggested using the modulus operator then use it.

    As I...
  3. Replies
    14
    Views
    12,635

    Re: Problem with -negative output

    If you think about what you need to achieve there are several ways of doing this.

    The modulus operator basically computes the remainder of a division operation, so the result of a modulus...
  4. Replies
    14
    Views
    12,635

    Re: Problem with -negative output

    I've already told you what you need to do.

    for example


    x = a * b;

    if ( x > c )
    x = c;
  5. Replies
    14
    Views
    12,635

    Re: Problem with -negative output

    Your calculation computes the number of lifeboats (9) times the number of people per boat (100) which equals 900 - where's the difficulty in working this out?

    No, it's the other way around. The...
Results 1 to 5 of 5





Click Here to Expand Forum to Full Width

Featured