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

Search:

Type: Posts; User: 2kaud

Search: Search took 0.42 seconds.

  1. Thread: Issue with code

    by 2kaud
    Replies
    13
    Views
    1,819

    Re: Issue with code

    Just for info. The code does have a problem. Try entering a non-numeric value for the number of cars.

    Have you covered stream errors yet?
  2. Thread: Issue with code

    by 2kaud
    Replies
    13
    Views
    1,819

    Re: Issue with code

    No. The maximum number is fixed at 20 - but the user enters the required number not greater than this. If the maximum is required to be more, then 20 can be changed to the required maximum number.
    ...
  3. Thread: Issue with code

    by 2kaud
    Replies
    13
    Views
    1,819

    Re: Issue with code

    The issue with arrays is that you have to declare their size at compile time - and with vectors you don't. So using an array you need to specify the maximum size as part of the code. In this case the...
  4. Thread: Issue with code

    by 2kaud
    Replies
    13
    Views
    1,819

    Re: Issue with code

    See the reply in post #3 re use of a vector.
  5. Thread: Issue with code

    by 2kaud
    Replies
    13
    Views
    1,819

    Re: Issue with code

    Have you come across the ternary ? operator yet?



    double calculate_charges ( double h ) {

    if ( h == 24 ) {

    return 10.00;
    }
  6. Thread: Issue with code

    by 2kaud
    Replies
    13
    Views
    1,819

    Re: Issue with code

    double chg = 3 + (( h - 3 ) *0.50);

    return chg;


    Why not just


    return 3 + (( h - 3 ) * 0.50);
  7. Thread: Issue with code

    by 2kaud
    Replies
    13
    Views
    1,819

    Re: Issue with code

    [Split into new thread]
Results 1 to 7 of 7





Click Here to Expand Forum to Full Width

Featured