Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
How are you trying to log out of your mac?
It should be System Preferences > select your name at the top > Overview > "Sign Out"
 
Yes id its ok now but when it comes to my iPhone it has two apple ids and when I sign in it asks mefor my other iphones passcode i put it incorrectly but it won't recognise it
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.