Select language
Search the Site
Ceebot / Dauphin Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Schoolbooks-->Branches-->Insect attack (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Schoolbooks-->Branches-->Insect attack
#28
admin (Admin)
Admin
Posts: 3
graphgraph
User Online Now Click here to see the profile of this user
Re:Schoolbooks-->Branches-->Insect attack 16 Years ago Karma: 1  
I don't understand why you want to use a switch statement. Simple if statements are better adapted to this exercise. You could use a switch statement if you have got a variable which contains the code of the key which has been previously pushed by the user. In this case you could use a switch on the content of this variable.

Your program looks quite OK, with the exception of the aim angle. You will probably have to allow for more possibilities than just 20 degrees upward and 20 degrees down. And why do you use the else statements? If the user pushes two keys at the same time, we would like the robot to perform both actions. Like this, you can write a program which is less complicated.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
      Topics Author Date
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop