Zobraziť príspevky

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Marek9011

Pages: [1]
1
1. ročník / karel-algoritmus
« on: 19.02.2011, 02:07:49 »
zdravim,
  • Potreboval by som aby karel robyl nizsie uvedene podmienky automaticky a nie aby som mu to vzdy prikazoval  (teda aby bol program prenositelny na ine svety ...vid priloha)
  • aky je rozdiel ak na zaciatku ked definujem funkcie dam namiesto void int ...na upsku som tak robil a funfuje to


Quote
#include <karel.h>

void turnRight(){   
turnLeft();   
turnLeft();   
turnLeft();}

void turnAround(){    
turnLeft();    
turnLeft();}

void oznac(){    
turnRight();    
movek();    
putBeeper();
turnAround();    
movek();    
turnRight();}




int main(){    
turnOn("road1.kw");
setStepDelay(300);

if (rightIsBlocked())
         {movek();}
     else{oznac();}
    
if (rightIsClear())
       {oznac();movek();}
       else{movek();}

    
  
turnOff();    
return 0;}

Pages: [1]