View Single Post
  #2 (permalink)  
Old November 6th, 2005, 08:37 PM
Paramesh Paramesh is offline
Authorized User
 
Join Date: Nov 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Paramesh
Default

Hi Dweeler,
The problem is this area:
Code:
int getBill (char x)
{
        if (x!='C' || x!='H')
                return 2;
        if (x!='c' || x!='h')
                return 2;
        if (x=='c' || x=='C')
                return 1;
        if (x=='h' || x=='H')
                return 0;
}
If you modify the code like this:
Code:
int getBill (char x)
{
        if(x == 'c' || x == 'C')
          return 0;
        else if (x == 'h' || x == 'H')
          return 1;
        else
          return 2;
}
then the code would run better.

Can you understand where have you made the error?

Regards,
Paramesh.
Reply With Quote