cout problem on chinese zodiac program

Hello. I'm making a Chinese zodiac program for fun, but regardless of what year I input I always get back "You were born in the year of the Dragon."
Thanks

#include


main()
{
int year; // four digit year
cout << "Enter your four digit birth year: ";
cin >> year;
if (year == 1976^1964)
{cout << "You were born in the year of the Dragon
";}

else if (year == 1981)
{cout << "Your were born in the year of the Rooster
";}

else if (year == 1982)
{cout << "Your were born in the year of the Dog
";}

return(0);
}

Comments

  • What are you trying to do here?

    : if (year == 1976^1964)

    1976 XOR 1964 is 20 decimal, or 00010100 binary.



    This isn't valid C++:

    : #include

    It should be #include


    This isn't valid C++:

    : main()

    It should be int main()

  • Thanks. I've got it straightened out now.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion