Jump to content

keyboard input

- - - - -

  • Please log in to reply
2 replies to this topic

#1
NicholasIT

NicholasIT

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
			if (key == 'w' ) //up

			{

				move = 1;

				if(key == 's')

				{

					error = true;

					cin.ignore();

				}

			}


i trying to do ,if the key is up ,it cannot be down ,and it will cont to move the up Key

but from my coding above,it does nt success
anyone can give some hints or idea to do it ?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What is that code supposed to do?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
how can the value of key be both 'w' and 's' at the same time? That's what the code you posted thinks it is.
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users