• Welcome to TUKE FÓRUM - Fórum pre študentov Technickej Univerzity v Košiciach.
 
Menu

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.

Zobrazi� pr�spevky Menu

Messages - Puma

#1
1. ročník / Re: Programovanie
07.03.2011, 05:13:39
Quote from: hardest on  07.03.2011, 03:50:40
tiez by som poprosil ak by mal niekto
Nech sa vám páči 3.Cviko doplňujúca č.1  ;)
#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;
    }