Hi, I have a problem here with the c++ if statement.

if (adult=1)
{
hotel=(adult*hotel)+(children*0.5*hotel) +(baby*0);
break;
}
else if (adult=2)
{
hotel=(adult*260*0.85) +(children*0.5*260) +(baby*0);
break;
}
else if (adult>2)
{
hotel=(adult*hotel*0.8) +(children*0.5*hotel) +(baby*0);
break;

the above is a small part of the code i'm doing. Problem here is, It is changing my adult input to 1 no matter what digits i enter.
eg:
input for adult is 4
however, the statement (adult>2) is not carried out whereas it is carried out under (adult=1).
i displayed the 'adult' before and after the if statements. before, it is fine but after, it isn't.
Need help here, thanks :)

1.) Please use [code-syntax]...code tags... [/code]. They make your code easier to read.

2.) You are making a common rookie mistake. You're using assignment statements instead of equality statements. Take another look at the operators used in your comparisons.

You need to use == when doing if statements. You are suppose to compare(==) not assign(=) in if statements.

EDIT:
A few seconds too late i suppose ;)

thank you very much. problem solved here:)