Quote from: hardest on 07.03.2011, 03:50:40Nech sa vám páči 3.Cviko doplňujúca č.1
tiez by som poprosil ak by mal niekto
Code [Select]
#include <stdio.h>
#include <karel.h>
void turnRight(){
turnLeft();
turnLeft();
turnLeft();
}
void turnAround(){
turnLeft();
turnLeft();
}
void polozX(int x){
while (x>0){
putBeeper();
x=x-1;
}
}
int zistiPocet(){
int pocet;
pocet=0;
while (beepersPresent()){
pickBeeper();
pocet=pocet+1;
}
return pocet;
}
/*--------------------------------------------------------*/
int main(){
int pocet,i;
pocet=0;
turnOn("stairsbuilder2.kw");
setStepDelay(100);
while (noBeepersPresent())
movek();
turnRight();
for (i=zistiPocet();i>0;i=i-1)
{
polozX(i);
movek();
}
turnAround();
while (frontIsClear()){
movek();
}
turnOff();
return 0;
}