Eliacem Galon wrote:

> if (dayCall>=1 && dayCall<=5)
> // 1 represent monday and 2 represents tuesday, so on..
>    { if (timestart>=0600 && timestart<=1800)
>        bill=(2.5 * timeduration);
>
>    else bill=(2.0 * timeduration);
>         pf("bill: %.2lf",bill);
>    }
> else
>     if (dayCall>=6 || dayCall<=7)
>    {    bill=(1.5 * timeduration);
>         pf("bill: %.2lf", bill);
>     }
>    else
>       pf("Invalid\n");/* why the computer say matching
> if or else.. when i input 0 or 9. they cannot find. or
> tell the computer invalid... i used already control
> structure. */
> }

I see a couple of things.

First, you're missing a closing '}' after your last else. That's why you're
getting the matching if error, I think.

Second, I think you want to use && for if (dayCall>=6 || dayCall<=7). That
is, if (dayCall>=6 && dayCall<=7). Think about the logic for a minute. If
you use or (||), then everything <=7 will meet the criteria. You probably
won't get there, because the first >=1 && <=5 will catch it, but it's a bug
waiting to happen.

Cordially,

Kerry Thompson




To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/c-prog/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to